﻿Imports System
Imports System.IO
Imports System.Threading
Imports System.Math
Public Class frmMage
    'Private Structure GearAttributes
    ' Dim Name, Meta, Socket(3), SocketGem(3), SocketBonus, Enchant As String
    ' End Structure
    'check DPS of adding cold snap override if <Icy Veins> fades and cold snap available instead of waiting for FoF for deepfreeze
    'check DPS of holding brain freeze till fof ghost charge
    'check if less than 8400 in a-PresenceofMindEnd<8400 is more DPS (should be)
    'check if <Arcane Power> effects dots of fireball, pyroblast, FrostfireBolt(0), fix arcane power affecting dots already applied
    Public ProgramVersion As String = "0.50", BaseMana As Integer = 3268
    Public frmProfile1, frmProfile2, frmProfile3, frmProfile4 As New frmProfileConfiguration

    'Dim sHead(100), sNeck(100), sShoulder(100), sBack(100), sChest(100), sWrist(100), sHands(100), sWaist(100), sLegs(100), sFeet(100), sRing1(100), sRing2(100), sTrinket1(100), sTrinket2(100), sMainHand(100), sOffHand(100), sWand(100) As GearAttributes

    Public ArcaneBlastMana(1), ArcaneBlastManaSpent, ArcaneMissileMana, ArcaneMissileManaSpent, FireballMana, IcyVeinsMana, MirrorImagesMana, PyroblastMana, LivingBombMana As Integer
    Public ScorchMana, FrostboltMana, FrostboltManaSpent, IceLanceMana, SummonWaterElementalMana As Integer
    Public ArcaneBlastMoERefund, ArcaneMissileMoERefund, FrostboltMoERefund, IceLanceMoERefund As Double
    Public ArcaneFocusPerc, SpellImpactCoef, StudentoftheMindCoef, ArcaneMeditationPerc, TormenttheWeakCoef As Double
    Public ArcaneMindCoef, ArcaneInstabilityCoef As Double
    Public MindMasteryPerc As Double
    Public PresenceofMindCD, ArcanePowerCD, FireballBaseCast, FrostboltBaseCast, IcyVeinsCD, ColdSnapCD As Integer
    Public MissileBarrageArcaneBlastPerc, MissileBarrageOtherPerc, IncinerationPerc As Double
    Public NetherwindPresenceCoef, SpellPowerPerc, IgniteAddPerc, WorldinFlamesPerc As Double
    Public bMasterofElements As Boolean, MasterofElementsPerc As Double
    Public PlayingWithFireCoef, CriticalMassPerc, FirePowerCoef As Double
    Public PyromaniacCritPerc, PyromaniacManaPerc, MoltenFuryCoef As Double, bMoltenFury As Boolean
    Public bEmpoweredFire As Boolean, EmpoweredFireIgniteRefundPerc As Double
    Public PrecisionPerc, PiercingIceCoef, FrostChannelingPerc, ArcticWindsCoef As Double
    Public IceShardsPerc, ShatterCritPerc(1), WintersChillApplicationPerc, WintersChillFrostboltCritPerc As Double
    Public FingersofFrostPerc, BrainFreezePerc, EnduringWinterApplicationPerc, T74PiecePerc As Double
    Public ChilledtotheBoneCoef, GearCritPerc, BuffCritPerc, GlobalCritPerc As Double
    Public bFocusMagic As Boolean
    Public ArcaneTalents, FireTalents, FrostTalents As Integer

    Public bTwoMinTrinket, TwoMinTrinket As Boolean, TwoMinTrinketStart As Integer
    Public EnergySiphon, LivingFlame, ScaleofFates, TalismanofResurgence, ShardoftheCrystalHeart, MaghiasMisguidedQuill As Boolean
    Public TFofVolatilePower As Boolean, TFofVolatilePowerStack, TFofVolatilePowerHaste As Integer, TFofVolatilePowerText As String
    Public MeteoriteCrystal As Boolean, MeteoriteCrystalStack As Integer
    Public bIllustrationoftheDragonSoul, IllustrationoftheDragonSoul As Boolean, IllustrationoftheDragonSoulStack, IllustrationoftheDragonSoulStart As Integer
    Public bEyeoftheBroodmother, EyeoftheBroodmother As Boolean, EyeoftheBroodmotherStack, EyeoftheBroodmotherStart As Integer
    Public bMuradinsSpyglass, MuradinsSpyglass As Boolean, MuradinsSpyglassStack, MuradinsSpyglassStart, MuradinsSpyglassSP As Integer, MuradinsSpyglassText As String
    Public bDyingCurse, DyingCurse As Boolean, DyingCurseStart As Integer
    Public bElementalFocusStone, ElementalFocusStone As Boolean, ElementalFocusStoneStart As Integer
    Public bFlareoftheHeavens, FlareoftheHeavens As Boolean, FlareoftheHeavensStart As Integer
    Public bPandorasPlea, PandorasPlea As Boolean, PandorasPleaStart As Integer
    Public bMoteofFlame, MoteofFlame As Boolean, MoteofFlameStart, MoteofFlameStack As Integer
    Public bShardofFlame, ShardofFlame As Boolean, ShardofFlameStart, ShardofFlameStack As Integer
    Public bShowofFaith, ShowofFaith As Boolean, ShowofFaithStart As Integer
    Public bSifsRemembrance, SifsRemembrance As Boolean, SifsRemembranceStart As Integer
    Public bEmbraceoftheSpider, EmbraceoftheSpider As Boolean, EmbraceoftheSpiderStart As Integer
    Public bSundialoftheExiled, SundialoftheExiled As Boolean, SundialoftheExiledStart As Integer
    Public bAbyssalRune, AbyssalRune As Boolean, AbyssalRuneStart As Integer
    Public bShardoftheGods, ShardoftheGods, bShinyShardoftheGods, ShinyShardoftheGods, bPurifiedShardoftheGods, PurifiedShardoftheGods As Boolean, ShardoftheGodsStart As Integer
    Public bDislodgedForeignObject, DislodgedForeignObject As Boolean, SurgeofPowerStart, SurgingPowerStack, DislodgedForeignObjectSP As Integer, DislodgedForeignObjectText As String
    Public bPurifiedLunarDust, PurifiedLunarDust As Boolean, PurifiedLunarDustStart As Integer
    Public bSliverofPureIce, SliverofPureIce As Boolean, SliverofPureIceStart, SliverofPureIceMana As Integer
    Public bPhylacteryoftheNamelessLich, PhylacteryoftheNamelessLich, PhylacteryFireball, PhylacteryFrostfireBolt As Boolean, PhylacteryoftheNamelessLichStart, PhylacteryoftheNamelessLichSP As Integer, PhylacteryoftheNamelessLichText As String
    Public bLightweave, Lightweave, bDarkglow, Darkglow As Boolean, LightweaveStart, DarkglowStart As Integer
    Public bNibelung, Valkyr(30) As Boolean, ValkyrTally, ValkyrCheckTally, ValkyrSummonTally, ValkyrGCD, ValkyrGCDStart(30), ValkyrStart(30), ValkyrServerLag(30) As Integer
    Public ValkyrCritPerc, ValkyrDamageCoef As Double
    Public bAshenBand, AshenBand As Boolean, AshenBandStart As Integer
    Public bBlackMagic, BlackMagic As Boolean, BlackMagicStart As Integer
    Public bT72Piece, T72Piece As Boolean, T7Count As Integer
    Public bT82Piece, T82Piece As Boolean, T82PieceStart, T8Count As Integer
    Public bT84Piece, T84Piece As Boolean
    Public bT92Piece As Boolean, T9Count As Integer, T94PiecePerc As Double
    Public bT102Piece, T102Piece As Boolean, T102PieceStart, T10Count As Integer, T102PieceCoef As Double
    Public bT104Piece, T104Piece As Boolean, T104PieceStart As Integer, T104PieceCoef As Double
    Public bBerserking, Berserking As Boolean, BerserkingStart As Integer, BerserkingCoef As Double
    Public bArcaneTorrent As Boolean, ArcaneTorrentStart As Integer

    Public bBurnout As Boolean, BurnoutCritPerc, BurnoutManaPerc As Double
    Public bMissileBarrage, MissileBarrage, TimetoReactMissileBarrage As Boolean, MissileBarrageStart As Integer
    Public bDeepFreeze As Boolean, DeepFreezeStart As Integer
    Public DeepFreezeCritPerc, DeepFreezeCritCoef, DeepFreezeMissPerc, DeepFreezeDamageCoef, DeepFreezeMana, DeepFreezeMoERefund, DeepFreezeBonusDamage, DeepFreezeBonusDamageCoef As Double
    Public bFireBlast As Boolean, FireBlastStart, FireBlastCD As Integer
    Public FireBlastCritPerc, FireBlastCritCoef, FireBlastMissPerc, FireBlastDamageCoef, FireBlastMana, FireBlastMoERefund, FireBlastBonusDamage, FireBlastBonusDamageCoef As Double
    Public FireBlastManaSpent As Double
    Public bPyroblast, Pyroblast, PyroblastCrits As Boolean, PyroblastFlightStart As Integer
    Public PyroblastCritPerc, PyroblastCritCoef, PyroblastMissPerc, PyroblastDamageCoef, PyroblastMoERefund, PyroblastManaSpent As Double
    Public PyroblastDoT As Boolean, PyroblastDoTStart As Integer, PyroblastDoTBonusDamage, PyroblastBonusDamage As Double
    Public bLivingBomb, LivingBomb As Boolean, LivingBombStart As Integer
    Public LivingBombCritPerc, LivingBombCritCoef, LivingBombMissPerc, LivingBombDamageCoef, LivingBombMoERefund, LivingBombManaSpent, LivingBombBonusDamage, LivingBombDoTBonusDamage As Double
    Public LivingBombBonusDamageCoef, LivingBombDamage, LivingBombDoTBonusDamageCoef, LivingBombDoTDamage, LivingBombDoTCritDamage As Double
    Public bWaterElemental, WaterElemental As Boolean, WaterElementalStart, WaterElementalCDStart, WaterElementalCDDuration, WaterElementalDuration, WaterElementalMaxMana, WaterElementalServerLag As Integer
    Public WaterElementalMana, WaterboltBonusDamage, WaterboltDamageCoef, WaterboltCritPerc, WaterboltMissPerc, WaterElementalReplenishmentValue As Double
    Public Waterbolt As Boolean, WaterboltStart, WaterboltFlightStart, WaterboltDur, WaterboltDuration(1) As Integer, WaterboltMana As Double
    Public bFingersofFrost, FingersofFrost As Boolean, FingersofFrostStart, FingersofFrostEnd, FingersofFrostCount, FingersofFrostPerceivedCount As Integer
    Public bBrainFreeze, bBrainFreezeFireball, bBrainFreezeFrostfireBolt, BrainFreeze, FrostfireBoltCanProcBrainFreeze As Boolean, BrainFreezeStart, TimetoReactBrainFreeze As Integer
    Public bIgnite, Ignite As Boolean, IgniteStart As Integer, IgnitePool As Double, IgniteRefund As Double = BaseMana * 0.02
    Public bCombustion, Combustion As Boolean, CombustionCount, PerceivedCombustionCount, CombustionEnd As Integer, CombustionCritPerc, CombustionDamagePerc As Double
    Public bHotStreak, HotStreak As Boolean, HotStreakStart(1), HotStreakCount As Integer, HotStreakPerc As Double
    Public bPresenceofMind, PresenceofMind As Boolean, PresenceofMindEnd As Integer
    Public bColdSnap As Boolean, ColdSnapStart As Integer
    Public bWintersChill, WintersChill As Boolean, WintersChillStart, WintersChillDebuffStack As Integer, WintersChillDebuffPerc As Double
    Public bClearcasting, Clearcasting As Boolean, ClearcastingStart As Integer, ClearcastingPerc As Double
    Public bArcanePotency, ArcanePotency As Boolean, ArcanePotencyPerc(1) As Double
    Public bIcyVeins, IcyVeins As Boolean, IcyVeinsCDStart, IcyVeinsStart As Integer, IcyVeinsCoef As Double
    Public bArcanePower, ArcanePower As Boolean, ArcanePowerStart As Integer, ArcanePowerCoef As Double
    Public bEnduringWinter, EnduringWinter As Boolean, EnduringWinterStart As Integer

    Public GCD As Boolean, GCDStart, GCDDuration(1) As Integer
    Public InvokeEvocation As Boolean, EvocationDuration, EvocationCD, EvocationCDStart, EvocationThreshold, LongestSpell As Integer, EvocationTickValue As Double
    Public bArcaneBlast, ArcaneBlastStack As Boolean
    Public ArcaneBlastStackCount, ArcaneBlastPerceivedStackCount, ArcaneBlastStackStart, ArcaneBlastDuration As Integer
    Public ArcaneBlastMissPerc, ArcaneBlastCritPerc, ArcaneBlastCritCoef, ArcaneBlastStackPerc, ArcaneBlastDamageCoef, ArcaneBlastBonusDamage As Double
    Public bArcaneMissile, ArcaneMissile, ArcaneMissileCrits(5) As Boolean, ArcaneMissileFlightStart(5), ArcaneMissileArcaneBlastStack As Integer
    Public ArcaneMissileDuration, ArcaneMissileMBDuration, ArcaneMissileQueuePenalty, ArcaneMissileFireInterval(5), ArcaneMissileFireTracker, ArcaneMissileLandTracker As Integer
    Public ArcaneMissileMissPerc, ArcaneMissileCritPerc, ArcaneMissileArcanePowerDamageCoef(5), ArcaneMissileCritCoef, ArcaneMissileDamageCoef, ArcaneMissileBonusDamage As Double
    Public AMCCPerc As Double
    Public bFireball, Fireball, FireballCrits As Boolean, FireballFlightStart, FireballDuration As Integer
    Public FireballCritPerc, FireballCritCoef, FireballMissPerc, FireballDamageCoef, FireballMoERefund, FireballManaSpent, FireballBonusDamage As Double
    Public bFireballDoT, FireballDoT As Boolean, FireballDoTStart As Integer, FireballDoTDamage As Double
    Public bScorch, bScorchFiller, Scorch, TimetoReactScorch As Boolean, ScorchDebuffStart, ScorchDuration As Integer
    Public ImpScorchCritPerc, ImpScorchDebuffApplicationPerc, ScorchBonusDamage As Double
    Public ScorchCritPerc, ScorchCritCoef, ScorchMissPerc, ScorchDamageCoef, ScorchDebuffPerc, GlyphofScorchCoef, ScorchMoERefund, ScorchManaSpent As Double
    Public bFrostfireBolt, FrostfireBolt(1), FrostfireBoltCrits(1) As Boolean, FrostfireBoltFlightStart(1), FrostfireBoltDuration, WhichFrostfireBolt As Integer
    Public FrostfireBoltCritPerc, FrostfireBoltCritCoef, FrostfireBoltMissPerc, FrostfireBoltDamageCoef, GlyphofFrostfireCoef, FrostfireBoltMana, FrostfireBoltManaSpent As Double
    Public FrostfireBoltBonusDamage, FrostfireBoltMoERefund, FrostfireBoltBonusDamageCoef, FrostfireBoltDamage(1) As Double
    Public FrostfireBoltDoT As Boolean, FrostfireBoltDoTStart As Integer, FrostfireBoltDoTDamage As Double
    Public bFrostbolt, Frostbolt, FrostboltCrits As Boolean, FrostboltDuration, FrostboltFlightStart As Integer
    Public FrostboltCritPerc, FrostboltCritCoef, FrostboltMissPerc, FrostboltDamageCoef, FrostboltBonusDamage As Double
    Public bIceLance, IceLance, IceLanceCrits As Boolean, IceLanceFlightStart As Integer
    Public IceLanceCritPerc, IceLanceCritCoef, IceLanceMissPerc, IceLanceDamageCoef, IceLanceFrozenCoef, IceLanceBonusDamage As Double
    Public ArcaneBlastBonusDamageCoef, ArcaneMissileBonusDamageCoef, ArcaneMissileDamage(5), FireballBonusDamageCoef, FireballDamage As Double
    Public FrostboltBonusDamageCoef, FrostboltDamage, IceLanceBonusDamageCoef, IceLanceDamage As Double
    Public PyroblastBonusDamageCoef, PyroblastDamage As Double
    Public PyroblastDoTBonusDamageCoef, PyroblastDoTDamage, ScorchBonusDamageCoef, WaterBoltBonusDamageCoef, WaterboltDamage As Double
    Public MirrorImages As Boolean, MirrorImagesStart, MirrorImagesCount As Integer

    Public bReplenishment As Boolean, ReplenishmentValue As Double
    Public bJoW, bMoltenArmor, bInsightfulEarthsiegeDiamond, InvokeManaGem As Boolean

    Public BonusDamage, HitRating, CritRating, HasteRating, StatMP5, GearMP5, Intellect, Spirit As Integer
    Public frmBonusDamage, frmHitRating, frmCritRating, frmHasteRating, frmIntellect, frmSpirit As Integer
    Public BonusDamageAdjust, HitRatingAdjust, CritRatingAdjust, HasteRatingAdjust, IntellectAdjust, SpiritAdjust As Integer
    Public bCreateLog, NotEvoFirst, bRMP As Boolean, bOoM As Boolean = True
    Public Casting, Channeling As Boolean, CastingStart, CastingDuration, WhichSpell As Integer
    Public bCoE, bHeroicPresence As Boolean
    Public GlobalMissPerc(1), GlobalDamageCoef(1), HasteCoef, fDamage, BaseCritCoef As Double
    Public GnomeCoef, HumanCoef, EmberSkyflareDiamondCoef, CoECoef, FISRAECoef, KingsCoef As Double
    Public JoWValue As Double = BaseMana * 0.02, BeamingEarthsiegeDiamondCoef, fTemp, fTemp2 As Double
    Public Mana, ManaGained, gManaGained, ManaConsumed, gManaConsumed, MP5CastingPerc, MP5NotCasting, MP5Casting As Double
    Public gDamage, gDamageTotal, RunTimeLimit, b, bOriginal As Long
    Public TwoPieceCount As Integer
    Public ManaDumpTimeLimit As Integer = 120000, a, z, zOriginal, lTemp, lTemp2, DamageManaDump, MCS, MGS, EvocationTickInterval As Integer
    Public DPS, HighestDPS, LowestDPS, DPSOriginal As Double
    Public AverageManaDump As Double, LongestManaDump, ShortestManaDump As Integer
    Public InsightfulEarthsiegeDiamondStart, MaxMana As Integer
    Public MP5Start, BonusDamageOriginal, HitRatingOriginal, CritRatingOriginal, HasteRatingOriginal, StatMP5Original, GearMP5Original, IntellectOriginal, SpiritOriginal As Integer
    Public ManaGemStart, ManaGemCount As Integer
    Public b4xABAM, b4xABMBAM, b3xABMBAM, b2xABMBAM, GlobalAdditoryCrit, bTemp As Boolean
    Public SpecURL, sLog, sTemp, sTemp2, sLogEntry, sLogTabIndex, sEvoFirst As String
    Public ProfileRunning As Integer
    'Public Head, Meta, HeadSocketColor(3), HeadSocket(3), HeadSocketBonus, HeadEnchant As String
    'Public Neck, NeckSocketColor(3), NeckSocket(3), NeckSocketBonus, NeckEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Back, BackSocketColor(3), BackSocket(3), BackSocketBonus, BackEnchant As String
    'Public Chest, ChestSocketColor(3), ChestSocket(3), ChestSocketBonus, ChestEnchant As String
    'Public Wrist, WristSocketColor(3), WristSocket(3), WristSocketBonus, WristEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    'Public Shoulder, ShoulderSocketColor(3), ShoulderSocket(3), ShoulderSocketBonus, ShoulderEnchant As String
    Public Trinket1, Trinket2 As String

    Public bGlyphofScorch, bGlyphofFrostfire, bGlyphofMoltenArmor, bGlyphofLivingBomb, bGlyphofFrostbolt, bGlyphofIceLance, bGlyphofEternalWater As Boolean
    Public bGlyphofArcaneMissile, bGlyphofArcaneBlast, bGlyphofArcanePower, bGlyphofMageArmor, bGlyphofManaGem As Boolean
    Public GlyphofFrostboltCoef, GlyphofFireballPerc, MageArmorPerc, ManaGemCoef, T72PieceCoef, MoltenArmorPerc, GlyphofArcaneMissilePerc, GlyphofMoltenArmorPerc As Double
    Public ArcanePowerDuration As Integer
    Public tArcaneSubtlety, tArcaneFocusPerc, tArcaneStability, tArcaneFortitude, tMagicAbsorption, tArcaneConcentration, tMagicAttunement, tSpellImpactCoef As Integer
    Public tStudentoftheMindCoef, tFocusMagic, tArcaneShielding, tImpCounterspell, tArcaneMeditation, tTormenttheWeakCoef, tImpBlink, tPresenceofMind, tArcaneMind As Integer
    Public tPrismaticCloak, tArcaneInstability, tArcanePotencyPerc, tArcaneEmpowerment, tArcanePower, tIncantersAbsorption, tArcaneFlows, tMindMastery As Integer
    Public tSlow, tMissileBarrage, tNetherwindPresence, tSpellPower, tArcaneBarrage As Integer
    Public tImpFireBlast, tIncineration, tImpFireball, tIgnite, tBurningDetermination, tWorldinFlames, tFlameThrowing, tImpact, tPyroblast, tBurningSoul As Integer
    Public tImpScorch, tMoltenShields, tMasterofElements, tPlayingwithFire, tCriticalMass, tBlastWave, tBlazingSpeed, tFirePower, tPyromaniac, tCombustion, tMoltenFury As Integer
    Public tFieryPayback, tEmpoweredFire, tFirestarter, tDragonsBreath, tHotStreak, tBurnout, tLivingBomb As Integer
    Public tFrostbite, tImpFrostbolt, tIceFlows, tIceShards, tFrostWarding, tPrecision, tPermafrost, tPiercingIce, tIcyVeins, tImpBlizzard, tArcticReach, tFrostChanneling, tShatter As Integer
    Public tColdSnap, tImpConeofCold, tFrozenCore, tColdasIce, tWintersChill, tShatteredBarrier, tIceBarrier, tArcticWinds, tEmpoweredFrostbolt, tFingersofFrost, tBrainFreeze As Integer
    Public tSummonWaterElemental, tEnduringWinter, tChilledtotheBone, tDeepFreeze As Integer
    Sub btnGoProfile1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoProfile1.Click
        ProfileRunning = 1 : Go()
    End Sub
    Sub btnGoProfile2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoProfile2.Click
        ProfileRunning = 2 : Go()
    End Sub
    Sub btnGoProfile3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoProfile3.Click
        ProfileRunning = 3 : Go()
    End Sub
    Sub btnGoProfile4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGoProfile4.Click
        ProfileRunning = 4 : Go()
    End Sub
    Sub Go()
        Select Case ProfileRunning
            Case 1
                btnGoProfile1.Enabled = False : btnGoProfile1.Text = "Compiling" : btnGoProfile2.Visible = False : btnGoProfile3.Visible = False : btnGoProfile4.Visible = False
                txtOverallDPSProfile1.Text = "" : txtHighestDPSProfile1.Text = "" : txtLowestDPSProfile1.Text = "" : txtAverageManaDumpProfile1.Text = "" : txtLongestManaDumpProfile1.Text = ""
                txtShortestManaDumpProfile1.Text = "" : txtDamageManaDumpProfile1.Text = "" : txtTotalManaDumpsProfile1.Text = "" : txtUseEvocationFirstProfile1.Text = ""
                txtManaConsumedSecondProfile1.Text = "" : txtManaGainedSecondProfile1.Text = "" : txtManaConsumedGainedProfile1.Text = "" : txt1DPSspProfile1.Text = ""
                txt1DPSHitProfile1.Text = "" : txtHitSPRatioProfile1.Text = "" : txt1DPSCritProfile1.Text = "" : txtCritSPRatioProfile1.Text = "" : txt1DPSHasteProfile1.Text = ""
                txtHasteSPRatioProfile1.Text = "" : txt1DPSIntellectProfile1.Text = "" : txtIntellectSPRatioProfile1.Text = "" : txtIntellectLongevityProfile1.Text = ""
                txt1DPSSpiritProfile1.Text = "" : txtSpiritSPRatioProfile1.Text = "" : txtSpiritLongevityProfile1.Text = ""
                If frmProfile1.cbCookieCutter.Checked Then SpecURL = frmProfile1.comboCookieCutter.Text Else SpecURL = frmProfile1.txtCustomSpec.Text
            Case 2
                btnGoProfile2.Enabled = False : btnGoProfile2.Text = "Compiling" : btnGoProfile1.Visible = False : btnGoProfile3.Visible = False : btnGoProfile4.Visible = False
                txtOverallDPSProfile2.Text = "" : txtHighestDPSProfile2.Text = "" : txtLowestDPSProfile2.Text = "" : txtAverageManaDumpProfile2.Text = "" : txtLongestManaDumpProfile2.Text = ""
                txtShortestManaDumpProfile2.Text = "" : txtDamageManaDumpProfile2.Text = "" : txtTotalManaDumpsProfile2.Text = "" : txtUseEvocationFirstProfile2.Text = ""
                txtManaConsumedSecondProfile2.Text = "" : txtManaGainedSecondProfile2.Text = "" : txtManaConsumedGainedProfile2.Text = "" : txt1DPSspProfile2.Text = ""
                txt1DPSHitProfile2.Text = "" : txtHitSPRatioProfile2.Text = "" : txt1DPSCritProfile2.Text = "" : txtCritSPRatioProfile2.Text = "" : txt1DPSHasteProfile2.Text = ""
                txtHasteSPRatioProfile2.Text = "" : txt1DPSIntellectProfile2.Text = "" : txtIntellectSPRatioProfile2.Text = "" : txtIntellectLongevityProfile2.Text = ""
                txt1DPSSpiritProfile2.Text = "" : txtSpiritSPRatioProfile2.Text = "" : txtSpiritLongevityProfile2.Text = ""
                If frmProfile2.cbCookieCutter.Checked Then SpecURL = frmProfile2.comboCookieCutter.Text Else SpecURL = frmProfile2.txtCustomSpec.Text
            Case 3
                btnGoProfile3.Enabled = False : btnGoProfile3.Text = "Compiling" : btnGoProfile1.Visible = False : btnGoProfile2.Visible = False : btnGoProfile4.Visible = False
                txtOverallDPSProfile3.Text = "" : txtHighestDPSProfile3.Text = "" : txtLowestDPSProfile3.Text = "" : txtAverageManaDumpProfile3.Text = "" : txtLongestManaDumpProfile3.Text = ""
                txtShortestManaDumpProfile3.Text = "" : txtDamageManaDumpProfile3.Text = "" : txtTotalManaDumpsProfile3.Text = "" : txtUseEvocationFirstProfile3.Text = ""
                txtManaConsumedSecondProfile3.Text = "" : txtManaGainedSecondProfile3.Text = "" : txtManaConsumedGainedProfile3.Text = "" : txt1DPSspProfile3.Text = ""
                txt1DPSHitProfile3.Text = "" : txtHitSPRatioProfile3.Text = "" : txt1DPSCritProfile3.Text = "" : txtCritSPRatioProfile3.Text = "" : txt1DPSHasteProfile3.Text = ""
                txtHasteSPRatioProfile3.Text = "" : txt1DPSIntellectProfile3.Text = "" : txtIntellectSPRatioProfile3.Text = "" : txtIntellectLongevityProfile3.Text = ""
                txt1DPSSpiritProfile3.Text = "" : txtSpiritSPRatioProfile3.Text = "" : txtSpiritLongevityProfile3.Text = ""
                If frmProfile3.cbCookieCutter.Checked Then SpecURL = frmProfile3.comboCookieCutter.Text Else SpecURL = frmProfile3.txtCustomSpec.Text
            Case 4
                btnGoProfile4.Enabled = False : btnGoProfile4.Text = "Compiling" : btnGoProfile1.Visible = False : btnGoProfile2.Visible = False : btnGoProfile3.Visible = False
                txtOverallDPSProfile4.Text = "" : txtHighestDPSProfile4.Text = "" : txtLowestDPSProfile4.Text = "" : txtAverageManaDumpProfile4.Text = "" : txtLongestManaDumpProfile4.Text = ""
                txtShortestManaDumpProfile4.Text = "" : txtDamageManaDumpProfile4.Text = "" : txtTotalManaDumpsProfile4.Text = "" : txtUseEvocationFirstProfile4.Text = ""
                txtManaConsumedSecondProfile4.Text = "" : txtManaGainedSecondProfile4.Text = "" : txtManaConsumedGainedProfile4.Text = "" : txt1DPSspProfile4.Text = ""
                txt1DPSHitProfile4.Text = "" : txtHitSPRatioProfile4.Text = "" : txt1DPSCritProfile4.Text = "" : txtCritSPRatioProfile4.Text = "" : txt1DPSHasteProfile4.Text = ""
                txtHasteSPRatioProfile4.Text = "" : txt1DPSIntellectProfile4.Text = "" : txtIntellectSPRatioProfile4.Text = "" : txtIntellectLongevityProfile4.Text = ""
                txt1DPSSpiritProfile4.Text = "" : txtSpiritSPRatioProfile4.Text = "" : txtSpiritLongevityProfile4.Text = ""
                If frmProfile4.cbCookieCutter.Checked Then SpecURL = frmProfile4.comboCookieCutter.Text Else SpecURL = frmProfile4.txtCustomSpec.Text
        End Select
        GetSpec() : sTemp = ArcaneTalents & "/" & FireTalents & "/" & FrostTalents
        Select Case ProfileRunning
            Case 1 : lblProfile1Spec.Text = sTemp
            Case 2 : lblProfile2Spec.Text = sTemp
            Case 3 : lblProfile3Spec.Text = sTemp
            Case 4 : lblProfile4Spec.Text = sTemp
        End Select
        ExtractfrmMage()
        SaveSettings()
        Select Case ProfileRunning
            Case 1 : btnGoProfile1.Text = "Fighting"
            Case 2 : btnGoProfile2.Text = "Fighting"
            Case 3 : btnGoProfile3.Text = "Fighting"
            Case 4 : btnGoProfile4.Text = "Fighting"
        End Select
        BonusDamageAdjust = 0 : HitRatingAdjust = 0 : CritRatingAdjust = 0 : HasteRatingAdjust = 0 : IntellectAdjust = 0 : SpiritAdjust = 0
        bCreateLog = False : RunTimeLimit = 30000000
        NotEvoFirst = False : MageEngine() : AverageManaDump = b / 100 / z
        NotEvoFirst = True : MageEngine() : fTemp = b / 100 / z
        If AverageManaDump >= fTemp Then NotEvoFirst = False Else NotEvoFirst = True
        If NotEvoFirst Then
            sEvoFirst = "Evocation SHOULD NOT be used before other mana restoration abilities for this run."
            Select Case ProfileRunning
                Case 1 : txtUseEvocationFirstProfile1.Text = "No"
                Case 2 : txtUseEvocationFirstProfile2.Text = "No"
                Case 3 : txtUseEvocationFirstProfile3.Text = "No"
                Case 4 : txtUseEvocationFirstProfile4.Text = "No"
            End Select
        Else
            sEvoFirst = "Evocation SHOULD be used before other mana restoration abilities for this run."
            Select Case ProfileRunning
                Case 1 : txtUseEvocationFirstProfile1.Text = "Yes"
                Case 2 : txtUseEvocationFirstProfile2.Text = "Yes"
                Case 3 : txtUseEvocationFirstProfile3.Text = "Yes"
                Case 4 : txtUseEvocationFirstProfile4.Text = "Yes"
            End Select
        End If
        If Abs(AverageManaDump - fTemp) < (AverageManaDump + fTemp) / 2 * 0.02 Then
            sEvoFirst = "Using Evocation before other mana restoration abilities makes no difference for this run."
            Select Case ProfileRunning
                Case 1 : txtUseEvocationFirstProfile1.Text = "No Matter"
                Case 2 : txtUseEvocationFirstProfile2.Text = "No Matter"
                Case 3 : txtUseEvocationFirstProfile3.Text = "No Matter"
                Case 4 : txtUseEvocationFirstProfile4.Text = "No Matter"
            End Select
        End If
        'Dim ArcaneThreadNormal As New Thread(New ThreadStart(AddressOf Arcane))
        sLog = My.Application.Info.DirectoryPath & "\Profile" & Str(ProfileRunning) & " " & ProgramVersion & ".txt"
        bCreateLog = True : RunTimeLimit = 100000000
        MageEngine()
        DPSOriginal = gDamageTotal / (b / 100)
        bOriginal = b
        zOriginal = z
        MCS = CInt(gManaConsumed / (b / 100))
        MGS = CInt(gManaGained / (b / 100))
        DamageManaDump = CInt(gDamageTotal / z)
        Select Case ProfileRunning
            Case 1 : txtOverallDPSProfile1.Text = CStr(CInt(DPSOriginal)) : txtHighestDPSProfile1.Text = CStr(HighestDPS) : txtLowestDPSProfile1.Text = CStr(LowestDPS) : txtTotalManaDumpsProfile1.Text = CStr(z) : txtManaConsumedSecondProfile1.Text = CStr(MCS) : txtManaGainedSecondProfile1.Text = CStr(MGS) : txtManaConsumedGainedProfile1.Text = CStr(MCS - MGS)
            Case 2 : txtOverallDPSProfile2.Text = CStr(CInt(DPSOriginal)) : txtHighestDPSProfile2.Text = CStr(HighestDPS) : txtLowestDPSProfile2.Text = CStr(LowestDPS) : txtTotalManaDumpsProfile2.Text = CStr(z) : txtManaConsumedSecondProfile2.Text = CStr(MCS) : txtManaGainedSecondProfile2.Text = CStr(MGS) : txtManaConsumedGainedProfile2.Text = CStr(MCS - MGS)
            Case 3 : txtOverallDPSProfile3.Text = CStr(CInt(DPSOriginal)) : txtHighestDPSProfile3.Text = CStr(HighestDPS) : txtLowestDPSProfile3.Text = CStr(LowestDPS) : txtTotalManaDumpsProfile3.Text = CStr(z) : txtManaConsumedSecondProfile3.Text = CStr(MCS) : txtManaGainedSecondProfile3.Text = CStr(MGS) : txtManaConsumedGainedProfile3.Text = CStr(MCS - MGS)
            Case 4 : txtOverallDPSProfile4.Text = CStr(CInt(DPSOriginal)) : txtHighestDPSProfile4.Text = CStr(HighestDPS) : txtLowestDPSProfile4.Text = CStr(LowestDPS) : txtTotalManaDumpsProfile4.Text = CStr(z) : txtManaConsumedSecondProfile4.Text = CStr(MCS) : txtManaGainedSecondProfile4.Text = CStr(MGS) : txtManaConsumedGainedProfile4.Text = CStr(MCS - MGS)
        End Select
        If Int(b / 100 / z / 60) > 19 Then
            Select Case ProfileRunning
                Case 1 : txtDamageManaDumpProfile1.Text = "-" : txtAverageManaDumpProfile1.Text = "20+ mins"
                Case 2 : txtDamageManaDumpProfile2.Text = "-" : txtAverageManaDumpProfile2.Text = "20+ mins"
                Case 3 : txtDamageManaDumpProfile3.Text = "-" : txtAverageManaDumpProfile3.Text = "20+ mins"
                Case 4 : txtDamageManaDumpProfile4.Text = "-" : txtAverageManaDumpProfile4.Text = "20+ mins"
            End Select
        Else
            sTemp = Int(b / 100 / z / 60) & ":" & Format(Int(b / 100 / z - Int(b / 100 / z / 60) * 60), "00")
            Select Case ProfileRunning
                Case 1 : txtDamageManaDumpProfile1.Text = CStr(DamageManaDump) : txtAverageManaDumpProfile1.Text = sTemp
                Case 2 : txtDamageManaDumpProfile2.Text = CStr(DamageManaDump) : txtAverageManaDumpProfile2.Text = sTemp
                Case 3 : txtDamageManaDumpProfile3.Text = CStr(DamageManaDump) : txtAverageManaDumpProfile3.Text = sTemp
                Case 4 : txtDamageManaDumpProfile4.Text = CStr(DamageManaDump) : txtAverageManaDumpProfile4.Text = sTemp
            End Select
        End If
        If Int(LongestManaDump / 100 / 60) > 19 Then
            Select Case ProfileRunning
                Case 1 : txtLongestManaDumpProfile1.Text = "20+ mins"
                Case 2 : txtLongestManaDumpProfile2.Text = "20+ mins"
                Case 3 : txtLongestManaDumpProfile3.Text = "20+ mins"
                Case 4 : txtLongestManaDumpProfile4.Text = "20+ mins"
            End Select
        Else
            sTemp = Int(LongestManaDump / 100 / 60) & ":" & Format(Int(LongestManaDump / 100 - Int(LongestManaDump / 100 / 60) * 60), "00")
            Select Case ProfileRunning
                Case 1 : txtLongestManaDumpProfile1.Text = sTemp
                Case 2 : txtLongestManaDumpProfile2.Text = sTemp
                Case 3 : txtLongestManaDumpProfile3.Text = sTemp
                Case 4 : txtLongestManaDumpProfile4.Text = sTemp
            End Select
        End If
        If Int(ShortestManaDump / 100 / 60) > 19 Then
            Select Case ProfileRunning
                Case 1 : txtShortestManaDumpProfile1.Text = "20+ mins"
                Case 2 : txtShortestManaDumpProfile2.Text = "20+ mins"
                Case 3 : txtShortestManaDumpProfile3.Text = "20+ mins"
                Case 4 : txtShortestManaDumpProfile4.Text = "20+ mins"
            End Select
        Else
            sTemp = Int(ShortestManaDump / 100 / 60) & ":" & Format(Int(ShortestManaDump / 100 - Int(ShortestManaDump / 100 / 60) * 60), "00")
            Select Case ProfileRunning
                Case 1 : txtShortestManaDumpProfile1.Text = sTemp
                Case 2 : txtShortestManaDumpProfile2.Text = sTemp
                Case 3 : txtShortestManaDumpProfile3.Text = sTemp
                Case 4 : txtShortestManaDumpProfile4.Text = sTemp
            End Select
        End If
        Application.DoEvents()

        BonusDamageAdjust = 150 : HitRatingAdjust = 0 : CritRatingAdjust = 0 : HasteRatingAdjust = 0 : IntellectAdjust = 0 : SpiritAdjust = 0 : MageEngine()
        fTemp = (BonusDamageAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
        Select Case ProfileRunning
            Case 1 : txt1DPSspProfile1.Text = Format(fTemp, "f")
            Case 2 : txt1DPSspProfile2.Text = Format(fTemp, "f")
            Case 3 : txt1DPSspProfile3.Text = Format(fTemp, "f")
            Case 4 : txt1DPSspProfile4.Text = Format(fTemp, "f")
        End Select
        Application.DoEvents()
        If bArcaneMissile Then fTemp = ArcaneMissileMissPerc Else fTemp = GlobalMissPerc(1)
        If fTemp < 0.0097 Then
            Select Case ProfileRunning
                Case 1 : txt1DPSHitProfile1.Text = "-" : txtHitSPRatioProfile1.Text = "-"
                Case 2 : txt1DPSHitProfile2.Text = "-" : txtHitSPRatioProfile2.Text = "-"
                Case 3 : txt1DPSHitProfile3.Text = "-" : txtHitSPRatioProfile3.Text = "-"
                Case 4 : txt1DPSHitProfile4.Text = "-" : txtHitSPRatioProfile4.Text = "-"
            End Select
        Else
            BonusDamageAdjust = 0 : HitRatingAdjust = 27 : CritRatingAdjust = 0 : HasteRatingAdjust = 0 : IntellectAdjust = 0 : SpiritAdjust = 0 : MageEngine()
            fTemp = (HitRatingAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
            Select Case ProfileRunning
                Case 1 : txt1DPSHitProfile1.Text = Format(fTemp, "f") : txtHitSPRatioProfile1.Text = CStr(Format(Val(txt1DPSHitProfile1.Text) / Val(txt1DPSspProfile1.Text), "f"))
                Case 2 : txt1DPSHitProfile2.Text = Format(fTemp, "f") : txtHitSPRatioProfile2.Text = CStr(Format(Val(txt1DPSHitProfile2.Text) / Val(txt1DPSspProfile2.Text), "f"))
                Case 3 : txt1DPSHitProfile3.Text = Format(fTemp, "f") : txtHitSPRatioProfile3.Text = CStr(Format(Val(txt1DPSHitProfile3.Text) / Val(txt1DPSspProfile3.Text), "f"))
                Case 4 : txt1DPSHitProfile4.Text = Format(fTemp, "f") : txtHitSPRatioProfile4.Text = CStr(Format(Val(txt1DPSHitProfile4.Text) / Val(txt1DPSspProfile4.Text), "f"))
            End Select
        End If
        Application.DoEvents()
        BonusDamageAdjust = 0 : HitRatingAdjust = 0 : CritRatingAdjust = 200 : HasteRatingAdjust = 0 : IntellectAdjust = 0 : SpiritAdjust = 0 : MageEngine()
        fTemp = (CritRatingAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
        Select Case ProfileRunning
            Case 1 : txt1DPSCritProfile1.Text = Format(fTemp, "f") : txtCritSPRatioProfile1.Text = CStr(Format(Val(txt1DPSCritProfile1.Text) / Val(txt1DPSspProfile1.Text), "f"))
            Case 2 : txt1DPSCritProfile2.Text = Format(fTemp, "f") : txtCritSPRatioProfile2.Text = CStr(Format(Val(txt1DPSCritProfile2.Text) / Val(txt1DPSspProfile2.Text), "f"))
            Case 3 : txt1DPSCritProfile3.Text = Format(fTemp, "f") : txtCritSPRatioProfile3.Text = CStr(Format(Val(txt1DPSCritProfile3.Text) / Val(txt1DPSspProfile3.Text), "f"))
            Case 4 : txt1DPSCritProfile4.Text = Format(fTemp, "f") : txtCritSPRatioProfile4.Text = CStr(Format(Val(txt1DPSCritProfile4.Text) / Val(txt1DPSspProfile4.Text), "f"))
        End Select
        Application.DoEvents()
        BonusDamageAdjust = 0 : HitRatingAdjust = 0 : CritRatingAdjust = 0 : HasteRatingAdjust = 100 : IntellectAdjust = 0 : SpiritAdjust = 0 : MageEngine()
        fTemp = (HasteRatingAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
        Select Case ProfileRunning
            Case 1 : txt1DPSHasteProfile1.Text = Format(fTemp, "f") : txtHasteSPRatioProfile1.Text = CStr(Format(Val(txt1DPSHasteProfile1.Text) / Val(txt1DPSspProfile1.Text), "f")) : Application.DoEvents()
            Case 2 : txt1DPSHasteProfile2.Text = Format(fTemp, "f") : txtHasteSPRatioProfile2.Text = CStr(Format(Val(txt1DPSHasteProfile2.Text) / Val(txt1DPSspProfile2.Text), "f")) : Application.DoEvents()
            Case 3 : txt1DPSHasteProfile3.Text = Format(fTemp, "f") : txtHasteSPRatioProfile3.Text = CStr(Format(Val(txt1DPSHasteProfile3.Text) / Val(txt1DPSspProfile3.Text), "f")) : Application.DoEvents()
            Case 4 : txt1DPSHasteProfile4.Text = Format(fTemp, "f") : txtHasteSPRatioProfile4.Text = CStr(Format(Val(txt1DPSHasteProfile4.Text) / Val(txt1DPSspProfile4.Text), "f")) : Application.DoEvents()
        End Select
        Application.DoEvents()
        BonusDamageAdjust = 0 : HitRatingAdjust = 0 : CritRatingAdjust = 0 : HasteRatingAdjust = 0 : IntellectAdjust = 400 : SpiritAdjust = 0 : MageEngine()
        fTemp = (IntellectAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
        Select Case ProfileRunning
            Case 1 : txt1DPSIntellectProfile1.Text = Format(fTemp, "f") : txtIntellectSPRatioProfile1.Text = CStr(Format(Val(txt1DPSIntellectProfile1.Text) / Val(txt1DPSspProfile1.Text), "f")) : If txtAverageManaDumpProfile1.Text = "20+ mins" Then txtIntellectLongevityProfile1.Text = "-" Else txtIntellectLongevityProfile1.Text = CStr(Format(bOriginal / zOriginal * 0.01 * IntellectAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 2 : txt1DPSIntellectProfile2.Text = Format(fTemp, "f") : txtIntellectSPRatioProfile2.Text = CStr(Format(Val(txt1DPSIntellectProfile2.Text) / Val(txt1DPSspProfile2.Text), "f")) : If txtAverageManaDumpProfile2.Text = "20+ mins" Then txtIntellectLongevityProfile2.Text = "-" Else txtIntellectLongevityProfile2.Text = CStr(Format(bOriginal / zOriginal * 0.01 * IntellectAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 3 : txt1DPSIntellectProfile3.Text = Format(fTemp, "f") : txtIntellectSPRatioProfile3.Text = CStr(Format(Val(txt1DPSIntellectProfile3.Text) / Val(txt1DPSspProfile3.Text), "f")) : If txtAverageManaDumpProfile3.Text = "20+ mins" Then txtIntellectLongevityProfile3.Text = "-" Else txtIntellectLongevityProfile3.Text = CStr(Format(bOriginal / zOriginal * 0.01 * IntellectAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 4 : txt1DPSIntellectProfile4.Text = Format(fTemp, "f") : txtIntellectSPRatioProfile4.Text = CStr(Format(Val(txt1DPSIntellectProfile4.Text) / Val(txt1DPSspProfile4.Text), "f")) : If txtAverageManaDumpProfile4.Text = "20+ mins" Then txtIntellectLongevityProfile4.Text = "-" Else txtIntellectLongevityProfile4.Text = CStr(Format(bOriginal / zOriginal * 0.01 * IntellectAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
        End Select
        Application.DoEvents()
        BonusDamageAdjust = 0 : HitRatingAdjust = 0 : CritRatingAdjust = 0 : HasteRatingAdjust = 0 : IntellectAdjust = 0 : SpiritAdjust = 400 : MageEngine()
        fTemp = (SpiritAdjust * DPSOriginal * 0.01) / (gDamageTotal / (b / 100) - DPSOriginal)
        Select Case ProfileRunning
            Case 1
                If bMoltenArmor Then txt1DPSSpiritProfile1.Text = Format(fTemp, "f") : txtSpiritSPRatioProfile1.Text = CStr(Format(Val(txt1DPSSpiritProfile1.Text) / Val(txt1DPSspProfile1.Text), "f")) Else txt1DPSSpiritProfile1.Text = "-" : txtSpiritSPRatioProfile1.Text = "-"
                If txtAverageManaDumpProfile1.Text = "20+ mins" Then txtSpiritLongevityProfile1.Text = "-" Else txtSpiritLongevityProfile1.Text = CStr(Format(bOriginal / zOriginal * 0.01 * SpiritAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 2
                If bMoltenArmor Then txt1DPSSpiritProfile2.Text = Format(fTemp, "f") : txtSpiritSPRatioProfile2.Text = CStr(Format(Val(txt1DPSSpiritProfile2.Text) / Val(txt1DPSspProfile2.Text), "f")) Else txt1DPSSpiritProfile2.Text = "-" : txtSpiritSPRatioProfile2.Text = "-"
                If txtAverageManaDumpProfile2.Text = "20+ mins" Then txtSpiritLongevityProfile2.Text = "-" Else txtSpiritLongevityProfile2.Text = CStr(Format(bOriginal / zOriginal * 0.01 * SpiritAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 3
                If bMoltenArmor Then txt1DPSSpiritProfile3.Text = Format(fTemp, "f") : txtSpiritSPRatioProfile3.Text = CStr(Format(Val(txt1DPSSpiritProfile3.Text) / Val(txt1DPSspProfile3.Text), "f")) Else txt1DPSSpiritProfile3.Text = "-" : txtSpiritSPRatioProfile3.Text = "-"
                If txtAverageManaDumpProfile3.Text = "20+ mins" Then txtSpiritLongevityProfile3.Text = "-" Else txtSpiritLongevityProfile3.Text = CStr(Format(bOriginal / zOriginal * 0.01 * SpiritAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
            Case 4
                If bMoltenArmor Then txt1DPSSpiritProfile4.Text = Format(fTemp, "f") : txtSpiritSPRatioProfile4.Text = CStr(Format(Val(txt1DPSSpiritProfile4.Text) / Val(txt1DPSspProfile4.Text), "f")) Else txt1DPSSpiritProfile4.Text = "-" : txtSpiritSPRatioProfile4.Text = "-"
                If txtAverageManaDumpProfile4.Text = "20+ mins" Then txtSpiritLongevityProfile4.Text = "-" Else txtSpiritLongevityProfile4.Text = CStr(Format(bOriginal / zOriginal * 0.01 * SpiritAdjust / (b / z - bOriginal / zOriginal), "f")) : Application.DoEvents()
        End Select

        Select Case ProfileRunning
            Case 1 : btnGoProfile1.Enabled = True : btnGoProfile1.Text = "Go!" : btnGoProfile2.Visible = True : btnGoProfile3.Visible = True : btnGoProfile4.Visible = True
            Case 2 : btnGoProfile2.Enabled = True : btnGoProfile2.Text = "Go!" : btnGoProfile1.Visible = True : btnGoProfile3.Visible = True : btnGoProfile4.Visible = True
            Case 3 : btnGoProfile3.Enabled = True : btnGoProfile3.Text = "Go!" : btnGoProfile1.Visible = True : btnGoProfile2.Visible = True : btnGoProfile4.Visible = True
            Case 4 : btnGoProfile4.Enabled = True : btnGoProfile4.Text = "Go!" : btnGoProfile1.Visible = True : btnGoProfile2.Visible = True : btnGoProfile3.Visible = True
        End Select
        Application.DoEvents() : SaveSettings()
    End Sub
    Sub GetSpec()
        Select Case SpecURL
            Case "Arcane (0/3 SotM)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=13100513010033015032310250532003000000000000000000000000002030230010000000000000000000"
            Case "Arcane (1/3 SotM)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=13100503110033015032310250532003000000000000000000000000002030230010000000000000000000"
            Case "Arcane (3/3 SotM)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=13100503310033015032310250532003000000000000000000000000002030230010000000000000000000"
            Case "Arcane (Scorch)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23000503110033015032310250532023050320003000000000000000000000000000000000000000000000"
            Case "Arcane (MoE)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23000503110033015032310250532023050320000030000000000000000000000000000000000000000000"
            Case "TtW Fireball (1/3 SotM)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23000503110003000000000000000000550300123033300531203003510000000000000000000000000000"
            Case "TtW Fireball (3/3 SotM)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23000503310003000000000000000000550300123033300531203003510000000000000000000000000000"
            Case "Frostfire (deep fire)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=00000000000000000000000000000023050300123033300531203003512033030310030000000000000000"
            Case "Frostfire (deep frost)" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=00000000000000000000000000000023050300023020000000000000003033030311233130230050231051"
            Case "Raid Frost" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23001500310003000000000000000000000000000000000000000000000533030311233100030052231151"
            Case "Scorch Build" : SpecURL = "http://www.wowarmory.com/talent-calc.xml?cid=8&tal=23000503110003000000000000000023050320123033300531203003510000000000000000000000000000"
        End Select
        For a = 1 To Len(SpecURL)
            sTemp = Mid(SpecURL, a, 1)
            If sTemp = "0" Or sTemp = "1" Or sTemp = "2" Then
                tArcaneSubtlety = CInt(Val(Mid(SpecURL, a, 1))) : tArcaneFocusPerc = CInt(Val(Mid(SpecURL, a + 1, 1))) : tArcaneStability = CInt(Val(Mid(SpecURL, a + 2, 1)))
                tArcaneFortitude = CInt(Val(Mid(SpecURL, a + 3, 1))) : tMagicAbsorption = CInt(Val(Mid(SpecURL, a + 4, 1))) : tArcaneConcentration = CInt(Val(Mid(SpecURL, a + 5, 1)))
                tMagicAttunement = CInt(Val(Mid(SpecURL, a + 6, 1))) : tSpellImpactCoef = CInt(Val(Mid(SpecURL, a + 7, 1))) : tStudentoftheMindCoef = CInt(Val(Mid(SpecURL, a + 8, 1))) : tFocusMagic = CInt(Val(Mid(SpecURL, a + 9, 1)))
                tArcaneShielding = CInt(Val(Mid(SpecURL, a + 10, 1))) : tImpCounterspell = CInt(Val(Mid(SpecURL, a + 11, 1))) : tArcaneMeditation = CInt(Val(Mid(SpecURL, a + 12, 1))) : tTormenttheWeakCoef = CInt(Val(Mid(SpecURL, a + 13, 1)))
                tImpBlink = CInt(Val(Mid(SpecURL, a + 14, 1))) : tPresenceofMind = CInt(Val(Mid(SpecURL, a + 15, 1))) : tArcaneMind = CInt(Val(Mid(SpecURL, a + 16, 1)))
                tPrismaticCloak = CInt(Val(Mid(SpecURL, a + 17, 1))) : tArcaneInstability = CInt(Val(Mid(SpecURL, a + 18, 1))) : tArcanePotencyPerc = CInt(Val(Mid(SpecURL, a + 19, 1)))
                tArcaneEmpowerment = CInt(Val(Mid(SpecURL, a + 20, 1))) : tArcanePower = CInt(Val(Mid(SpecURL, a + 21, 1))) : tIncantersAbsorption = CInt(Val(Mid(SpecURL, a + 22, 1)))
                tArcaneFlows = CInt(Val(Mid(SpecURL, a + 23, 1))) : tMindMastery = CInt(Val(Mid(SpecURL, a + 24, 1)))
                tSlow = CInt(Val(Mid(SpecURL, a + 25, 1))) : tMissileBarrage = CInt(Val(Mid(SpecURL, a + 26, 1)))
                tNetherwindPresence = CInt(Val(Mid(SpecURL, a + 27, 1))) : tSpellPower = CInt(Val(Mid(SpecURL, a + 28, 1)))
                tArcaneBarrage = CInt(Val(Mid(SpecURL, a + 29, 1)))
                tImpFireBlast = CInt(Val(Mid(SpecURL, a + 30, 1))) : tIncineration = CInt(Val(Mid(SpecURL, a + 31, 1))) : tImpFireball = CInt(Val(Mid(SpecURL, a + 32, 1)))
                tIgnite = CInt(Val(Mid(SpecURL, a + 33, 1))) : tBurningDetermination = CInt(Val(Mid(SpecURL, a + 34, 1))) : tWorldinFlames = CInt(Val(Mid(SpecURL, a + 35, 1)))
                tFlameThrowing = CInt(Val(Mid(SpecURL, a + 36, 1))) : tImpact = CInt(Val(Mid(SpecURL, a + 37, 1))) : tPyroblast = CInt(Val(Mid(SpecURL, a + 38, 1))) : tBurningSoul = CInt(Val(Mid(SpecURL, a + 39, 1)))
                tImpScorch = CInt(Val(Mid(SpecURL, a + 40, 1))) : tMoltenShields = CInt(Val(Mid(SpecURL, a + 41, 1))) : tMasterofElements = CInt(Val(Mid(SpecURL, a + 42, 1)))
                tPlayingwithFire = CInt(Val(Mid(SpecURL, a + 43, 1))) : tCriticalMass = CInt(Val(Mid(SpecURL, a + 44, 1))) : tBlastWave = CInt(Val(Mid(SpecURL, a + 45, 1)))
                tBlazingSpeed = CInt(Val(Mid(SpecURL, a + 46, 1))) : tFirePower = CInt(Val(Mid(SpecURL, a + 47, 1)))
                tPyromaniac = CInt(Val(Mid(SpecURL, a + 48, 1))) : tCombustion = CInt(Val(Mid(SpecURL, a + 49, 1))) : tMoltenFury = CInt(Val(Mid(SpecURL, a + 50, 1)))
                tFieryPayback = CInt(Val(Mid(SpecURL, a + 51, 1))) : tEmpoweredFire = CInt(Val(Mid(SpecURL, a + 52, 1)))
                tFirestarter = CInt(Val(Mid(SpecURL, a + 53, 1))) : tDragonsBreath = CInt(Val(Mid(SpecURL, a + 54, 1))) : tHotStreak = CInt(Val(Mid(SpecURL, a + 55, 1)))
                tBurnout = CInt(Val(Mid(SpecURL, a + 56, 1)))
                tLivingBomb = CInt(Val(Mid(SpecURL, a + 57, 1)))
                tFrostbite = CInt(Val(Mid(SpecURL, a + 58, 1))) : tImpFrostbolt = CInt(Val(Mid(SpecURL, a + 59, 1))) : tIceFlows = CInt(Val(Mid(SpecURL, a + 60, 1)))
                tIceShards = CInt(Val(Mid(SpecURL, a + 61, 1))) : tFrostWarding = CInt(Val(Mid(SpecURL, a + 62, 1))) : tPrecision = CInt(Val(Mid(SpecURL, a + 63, 1))) : tPermafrost = CInt(Val(Mid(SpecURL, a + 64, 1)))
                tPiercingIce = CInt(Val(Mid(SpecURL, a + 65, 1))) : tIcyVeins = CInt(Val(Mid(SpecURL, a + 66, 1))) : tImpBlizzard = CInt(Val(Mid(SpecURL, a + 67, 1)))
                tArcticReach = CInt(Val(Mid(SpecURL, a + 68, 1))) : tFrostChanneling = CInt(Val(Mid(SpecURL, a + 69, 1))) : tShatter = CInt(Val(Mid(SpecURL, a + 70, 1)))
                tColdSnap = CInt(Val(Mid(SpecURL, a + 71, 1))) : tImpConeofCold = CInt(Val(Mid(SpecURL, a + 72, 1))) : tFrozenCore = CInt(Val(Mid(SpecURL, a + 73, 1)))
                tColdasIce = CInt(Val(Mid(SpecURL, a + 74, 1))) : tWintersChill = CInt(Val(Mid(SpecURL, a + 75, 1)))
                tShatteredBarrier = CInt(Val(Mid(SpecURL, a + 76, 1))) : tIceBarrier = CInt(Val(Mid(SpecURL, a + 77, 1))) : tArcticWinds = CInt(Val(Mid(SpecURL, a + 78, 1)))
                tEmpoweredFrostbolt = CInt(Val(Mid(SpecURL, a + 79, 1))) : tFingersofFrost = CInt(Val(Mid(SpecURL, a + 80, 1)))
                tBrainFreeze = CInt(Val(Mid(SpecURL, a + 81, 1))) : tSummonWaterElemental = CInt(Val(Mid(SpecURL, a + 82, 1))) : tEnduringWinter = CInt(Val(Mid(SpecURL, a + 83, 1)))
                tChilledtotheBone = CInt(Val(Mid(SpecURL, a + 84, 1)))
                tDeepFreeze = CInt(Val(Mid(SpecURL, a + 85, 1)))
                Exit For
            End If
        Next

        ArcaneTalents = tArcaneSubtlety + tArcaneFocusPerc + tArcaneStability + tArcaneFortitude + tMagicAbsorption + tArcaneConcentration + tMagicAttunement + tSpellImpactCoef + tStudentoftheMindCoef + tFocusMagic + tArcaneShielding + tImpCounterspell + tArcaneMeditation + tTormenttheWeakCoef + tImpBlink + tPresenceofMind + tArcaneMind + tPrismaticCloak + tArcaneInstability + tArcanePotencyPerc + tArcaneEmpowerment + tArcanePower + tIncantersAbsorption + tArcaneFlows + tMindMastery + tSlow + tMissileBarrage + tNetherwindPresence + tSpellPower + tArcaneBarrage
        FireTalents = tImpFireBlast + tIncineration + tImpFireball + tIgnite + tBurningDetermination + tWorldinFlames + tFlameThrowing + tImpact + tPyroblast + tBurningSoul + tImpScorch + tMoltenShields + tMasterofElements + tPlayingwithFire + tCriticalMass + tBlastWave + tBlazingSpeed + tFirePower + tPyromaniac + tCombustion + tMoltenFury + tFieryPayback + tEmpoweredFire + tFirestarter + tDragonsBreath + tHotStreak + tBurnout + tLivingBomb
        FrostTalents = tFrostbite + tImpFrostbolt + tIceFlows + tIceShards + tFrostWarding + tPrecision + tPermafrost + tPiercingIce + tIcyVeins + tImpBlizzard + tArcticReach + tFrostChanneling + tShatter + tColdSnap + tImpConeofCold + tFrozenCore + tColdasIce + tWintersChill + tShatteredBarrier + tIceBarrier + tArcticWinds + tEmpoweredFrostbolt + tFingersofFrost + tBrainFreeze + tSummonWaterElemental + tEnduringWinter + tChilledtotheBone + tDeepFreeze

        ArcaneFocusPerc = tArcaneFocusPerc * 0.01
        ClearcastingPerc = tArcaneConcentration * 2 / 100 : AMCCPerc = ClearcastingPerc / 5 : bClearcasting = tArcaneConcentration > 0
        SpellImpactCoef = tSpellImpactCoef * 0.02 + 1
        Select Case tStudentoftheMindCoef
            Case 0 : StudentoftheMindCoef = 1
            Case 1 : StudentoftheMindCoef = 1.04
            Case 2 : StudentoftheMindCoef = 1.07
            Case 3 : StudentoftheMindCoef = 1.1
        End Select
        bFocusMagic = tFocusMagic = 1
        Select Case tArcaneMeditation
            Case 0 : ArcaneMeditationPerc = 0
            Case 1 : ArcaneMeditationPerc = 0.17
            Case 2 : ArcaneMeditationPerc = 0.33
            Case 3 : ArcaneMeditationPerc = 0.5
        End Select
        TormenttheWeakCoef = tTormenttheWeakCoef * 0.04 + 1
        ArcaneMindCoef = tArcaneMind * 0.03 + 1
        bPresenceofMind = tPresenceofMind = 1
        ArcaneInstabilityCoef = tArcaneInstability * 0.01 + 1
        ArcanePotencyPerc(0) = tArcanePotencyPerc * 0.15 : bArcanePotency = ArcanePotencyPerc(0) > 0
        bArcanePower = tArcanePower = 1
        PresenceofMindCD = CInt(12000 * (1 - tArcaneFlows * 0.15)) : ArcanePowerCD = CInt(12000 * (1 - tArcaneFlows * 0.15)) : EvocationCD = 23999 - 6000 * tArcaneFlows
        MindMasteryPerc = tMindMastery * 0.03
        MissileBarrageOtherPerc = tMissileBarrage * 0.04 : MissileBarrageArcaneBlastPerc = MissileBarrageOtherPerc * 2 : bMissileBarrage = tMissileBarrage > 0
        NetherwindPresenceCoef = tNetherwindPresence * 0.02 + 1
        SpellPowerPerc = tSpellPower * 0.25

        FireBlastCD = 800 - 100 * tImpFireBlast
        IncinerationPerc = tIncineration * 0.02
        FireballBaseCast = 350 - tImpFireball * 10
        IgniteAddPerc = tIgnite * 0.08 : bIgnite = tIgnite > 0
        WorldinFlamesPerc = tWorldinFlames * 0.02
        bPyroblast = tPyroblast = 1
        ImpScorchCritPerc = tImpScorch * 0.01 : ImpScorchDebuffApplicationPerc = tImpScorch / 3 : bScorch = tImpScorch > 0
        MasterofElementsPerc = tMasterofElements * 0.1 : bMasterofElements = tMasterofElements > 0
        PlayingWithFireCoef = tPlayingwithFire * 0.01 + 1
        CriticalMassPerc = tCriticalMass * 0.02
        FirePowerCoef = tFirePower * 0.02 + 1
        PyromaniacCritPerc = tPyromaniac * 0.01
        Select Case tPyromaniac
            Case 0 : PyromaniacManaPerc = 0
            Case 1 : PyromaniacManaPerc = 0.17
            Case 2 : PyromaniacManaPerc = 0.33
            Case 3 : PyromaniacManaPerc = 0.5
        End Select
        bCombustion = tCombustion = 1
        MoltenFuryCoef = tMoltenFury * 0.06 + 1 : bMoltenFury = tMoltenFury > 0
        EmpoweredFireIgniteRefundPerc = tEmpoweredFire / 3 : bEmpoweredFire = tEmpoweredFire > 0
        HotStreakPerc = tHotStreak / 3 : bHotStreak = tHotStreak > 0
        BurnoutCritPerc = tBurnout * 0.1 : BurnoutManaPerc = tBurnout * 0.01 : bBurnout = tBurnout > 0
        bLivingBomb = tLivingBomb = 1

        FrostboltBaseCast = 300 - 10 * tImpFrostbolt
        Select Case tIceFlows
            Case 0 : IcyVeinsCD = 18000
            Case 1 : IcyVeinsCD = CInt(18000 * 0.93)
            Case 2 : IcyVeinsCD = CInt(18000 * 0.86)
            Case 3 : IcyVeinsCD = CInt(18000 * 0.8)
        End Select
        IceShardsPerc = tIceShards / 3
        PrecisionPerc = tPrecision * 0.01
        PiercingIceCoef = tPiercingIce * 0.02 + 1
        bIcyVeins = tIcyVeins = 1
        Select Case tFrostChanneling
            Case 0 : FrostChannelingPerc = 0
            Case 1 : FrostChannelingPerc = 0.04
            Case 2 : FrostChannelingPerc = 0.07
            Case 3 : FrostChannelingPerc = 0.1
        End Select
        Select Case tShatter
            Case 0 : ShatterCritPerc(0) = 0
            Case 1 : ShatterCritPerc(0) = 0.17
            Case 2 : ShatterCritPerc(0) = 0.33
            Case 3 : ShatterCritPerc(0) = 0.5
        End Select
        bColdSnap = tColdSnap = 1
        ColdSnapCD = CInt(48000 * (1 - tColdasIce * 0.1))
        WaterElementalCDDuration = CInt(18000 * (1 - tColdasIce * 0.1))
        WintersChillFrostboltCritPerc = tWintersChill * 0.01 : WintersChillApplicationPerc = tWintersChill / 3 : bWintersChill = tWintersChill > 0
        ArcticWindsCoef = tArcticWinds * 0.01 + 1
        FrostboltBaseCast -= 10 * tEmpoweredFrostbolt
        Select Case tFingersofFrost
            Case 0 : FingersofFrostPerc = 0
            Case 1 : FingersofFrostPerc = 0.07
            Case 2 : FingersofFrostPerc = 0.15
        End Select
        bFingersofFrost = tFingersofFrost > 0
        BrainFreezePerc = tBrainFreeze * 0.05 : bBrainFreeze = tBrainFreeze > 0 : bBrainFreezeFrostfireBolt = bBrainFreeze : bBrainFreezeFireball = False
        bWaterElemental = tSummonWaterElemental = 1
        WaterElementalDuration = 4500 + 500 * tEnduringWinter : EnduringWinterApplicationPerc = tEnduringWinter / 3
        ChilledtotheBoneCoef = tChilledtotheBone * 0.01 + 1
        bDeepFreeze = tDeepFreeze = 1

        ArcaneMissileBonusDamageCoef = (5 / 3.5 + tArcaneEmpowerment * 0.15) / 5
        ArcaneBlastBonusDamageCoef = 2.5 / 3.5 + tArcaneEmpowerment * 0.03
        DeepFreezeBonusDamageCoef = 7.5 / 3.5
        FireBlastBonusDamageCoef = 1.5 / 3.5
        FireballBonusDamageCoef = 1 + tEmpoweredFire * 0.05
        FrostboltBonusDamageCoef = 3 / 3.5 + tEmpoweredFrostbolt * 0.05
        FrostfireBoltBonusDamageCoef = 3 / 3.5 + tEmpoweredFire * 0.05
        IceLanceBonusDamageCoef = 0.5 / 3.5
        LivingBombBonusDamageCoef = 1.4 / 3.5
        LivingBombDoTBonusDamageCoef = 0.7 / 3.5
        PyroblastBonusDamageCoef = 1.15 + tEmpoweredFire * 0.05
        PyroblastDoTBonusDamageCoef = 0.05
        ScorchBonusDamageCoef = 1.5 / 3.5
        WaterBoltBonusDamageCoef = 0.333333333333333 * 0.833333333333333
    End Sub
    Sub ExtractfrmMage()
        If cbToWSP.Checked Then cbToWCrit.Checked = True
        Select Case ProfileRunning
            Case 1 : BonusDamage = CInt(Val(frmProfile1.txtBonusDamage.Text)) : HitRating = CInt(Val(frmProfile1.txtHitRating.Text)) : CritRating = CInt(Val(frmProfile1.txtCritRating.Text)) : HasteRating = CInt(Val(frmProfile1.txtHasteRating.Text)) : GearMP5 = CInt(Val(frmProfile1.txtManaRegen.Text)) : Intellect = CInt(Val(frmProfile1.txtIntellect.Text)) : Spirit = CInt(Val(frmProfile1.txtSpirit.Text))
            Case 2 : BonusDamage = CInt(Val(frmProfile2.txtBonusDamage.Text)) : HitRating = CInt(Val(frmProfile2.txtHitRating.Text)) : CritRating = CInt(Val(frmProfile2.txtCritRating.Text)) : HasteRating = CInt(Val(frmProfile2.txtHasteRating.Text)) : GearMP5 = CInt(Val(frmProfile2.txtManaRegen.Text)) : Intellect = CInt(Val(frmProfile2.txtIntellect.Text)) : Spirit = CInt(Val(frmProfile2.txtSpirit.Text))
            Case 3 : BonusDamage = CInt(Val(frmProfile3.txtBonusDamage.Text)) : HitRating = CInt(Val(frmProfile3.txtHitRating.Text)) : CritRating = CInt(Val(frmProfile3.txtCritRating.Text)) : HasteRating = CInt(Val(frmProfile3.txtHasteRating.Text)) : GearMP5 = CInt(Val(frmProfile3.txtManaRegen.Text)) : Intellect = CInt(Val(frmProfile3.txtIntellect.Text)) : Spirit = CInt(Val(frmProfile3.txtSpirit.Text))
            Case 4 : BonusDamage = CInt(Val(frmProfile4.txtBonusDamage.Text)) : HitRating = CInt(Val(frmProfile4.txtHitRating.Text)) : CritRating = CInt(Val(frmProfile4.txtCritRating.Text)) : HasteRating = CInt(Val(frmProfile4.txtHasteRating.Text)) : GearMP5 = CInt(Val(frmProfile4.txtManaRegen.Text)) : Intellect = CInt(Val(frmProfile4.txtIntellect.Text)) : Spirit = CInt(Val(frmProfile4.txtSpirit.Text))
        End Select
        GlyphofScorchCoef = 1
        GlyphofFrostfireCoef = 1
        GlyphofFireballPerc = 0 : bFireballDoT = True
        GlyphofMoltenArmorPerc = 0
        bGlyphofLivingBomb = False
        GlyphofFrostboltCoef = 1
        IceLanceFrozenCoef = 3 : bIceLance = False
        bGlyphofEternalWater = False
        GlyphofArcaneMissilePerc = 0
        ArcaneBlastStackPerc = 0.15
        ArcanePowerDuration = 1500
        MageArmorPerc = 0.5
        ManaGemCoef = 1
        For a = 2 To 0 Step -1
            Select Case a
                Case 2
                    Select Case ProfileRunning
                        Case 1 : sTemp = frmProfile1.comboGlyph1.Text
                        Case 2 : sTemp = frmProfile2.comboGlyph1.Text
                        Case 3 : sTemp = frmProfile3.comboGlyph1.Text
                        Case 4 : sTemp = frmProfile4.comboGlyph1.Text
                    End Select
                Case 1
                    Select Case ProfileRunning
                        Case 1 : sTemp = frmProfile1.comboGlyph2.Text
                        Case 2 : sTemp = frmProfile2.comboGlyph2.Text
                        Case 3 : sTemp = frmProfile3.comboGlyph2.Text
                        Case 4 : sTemp = frmProfile4.comboGlyph2.Text
                    End Select
                Case 0
                    Select Case ProfileRunning
                        Case 1 : sTemp = frmProfile1.comboGlyph3.Text
                        Case 2 : sTemp = frmProfile2.comboGlyph3.Text
                        Case 3 : sTemp = frmProfile3.comboGlyph3.Text
                        Case 4 : sTemp = frmProfile4.comboGlyph3.Text
                    End Select
            End Select
            Select Case sTemp
                Case "Arcane Blast" : ArcaneBlastStackPerc = 0.18
                Case "Arcane Missiles" : GlyphofArcaneMissilePerc = 0.25
                Case "Arcane Power" : ArcanePowerDuration += 300
                Case "Eternal Water" : bGlyphofEternalWater = True
                Case "Fireball" : FireballBaseCast -= 15 : bFireballDoT = False
                Case "Frostbolt" : GlyphofFrostboltCoef = 1.05
                Case "Frostfire" : GlyphofFrostfireCoef = 1.02
                Case "Ice Lance" : IceLanceFrozenCoef = 4 : bIceLance = True
                Case "Living Bomb" : bGlyphofLivingBomb = True
                Case "Mage Armor" : MageArmorPerc = 0.7
                Case "Mana Gem" : ManaGemCoef = 1.4
                Case "Molten Armor" : GlyphofMoltenArmorPerc = 0.2
                Case "Scorch" : GlyphofScorchCoef = 1.2
            End Select
        Next
        HumanCoef = 1 : GnomeCoef = 1 : bBerserking = False : BerserkingCoef = 1 : bArcaneTorrent = False : bHeroicPresence = cbHeroicPresence.Checked
        Select Case ProfileRunning
            Case 1 : sTemp = frmProfile1.comboRace.Text
            Case 2 : sTemp = frmProfile2.comboRace.Text
            Case 3 : sTemp = frmProfile3.comboRace.Text
            Case 4 : sTemp = frmProfile4.comboRace.Text
        End Select
        Select Case sTemp
            Case "Draenei" : bHeroicPresence = True
            Case "Human" : HumanCoef = 1.03
            Case "Gnome" : GnomeCoef = 1.05
            Case "Troll" : bBerserking = True : bHeroicPresence = False
            Case "Blood Elf" : bArcaneTorrent = True : bHeroicPresence = False
            Case "Undead" : bHeroicPresence = False
        End Select
        T7Count = 0 : T8Count = 0 : T9Count = 0 : T10Count = 0
        Select Case ProfileRunning
            Case 1 : sTemp = frmProfile1.comboMeta.Text : Trinket1 = frmProfile1.comboTrinket1.Text : Trinket2 = frmProfile1.comboTrinket2.Text
                If frmProfile1.cbT74Piece.Checked Then T7Count = 4 Else If frmProfile1.cbT72Piece.Checked Then T7Count = 2
                If frmProfile1.cbT84Piece.Checked Then T8Count = 4 Else If frmProfile1.cbT82Piece.Checked Then T8Count = 2
                If frmProfile1.cbT94Piece.Checked Then T9Count = 4 Else If frmProfile1.cbT92Piece.Checked Then T9Count = 2
                If frmProfile1.cbT104Piece.Checked Then T10Count = 4 Else If frmProfile1.cbT102Piece.Checked Then T10Count = 2
            Case 2 : sTemp = frmProfile2.comboMeta.Text : Trinket1 = frmProfile2.comboTrinket1.Text : Trinket2 = frmProfile2.comboTrinket2.Text
                If frmProfile2.cbT74Piece.Checked Then T7Count = 4 Else If frmProfile2.cbT72Piece.Checked Then T7Count = 2
                If frmProfile2.cbT84Piece.Checked Then T8Count = 4 Else If frmProfile2.cbT82Piece.Checked Then T8Count = 2
                If frmProfile2.cbT94Piece.Checked Then T9Count = 4 Else If frmProfile2.cbT92Piece.Checked Then T9Count = 2
                If frmProfile2.cbT104Piece.Checked Then T10Count = 4 Else If frmProfile2.cbT102Piece.Checked Then T10Count = 2
            Case 3 : sTemp = frmProfile3.comboMeta.Text : Trinket1 = frmProfile3.comboTrinket1.Text : Trinket2 = frmProfile3.comboTrinket2.Text
                If frmProfile3.cbT74Piece.Checked Then T7Count = 4 Else If frmProfile3.cbT72Piece.Checked Then T7Count = 2
                If frmProfile3.cbT84Piece.Checked Then T8Count = 4 Else If frmProfile3.cbT82Piece.Checked Then T8Count = 2
                If frmProfile3.cbT94Piece.Checked Then T9Count = 4 Else If frmProfile3.cbT92Piece.Checked Then T9Count = 2
                If frmProfile3.cbT104Piece.Checked Then T10Count = 4 Else If frmProfile3.cbT102Piece.Checked Then T10Count = 2
            Case 4 : sTemp = frmProfile4.comboMeta.Text : Trinket1 = frmProfile4.comboTrinket1.Text : Trinket2 = frmProfile4.comboTrinket2.Text
                If frmProfile4.cbT74Piece.Checked Then T7Count = 4 Else If frmProfile4.cbT72Piece.Checked Then T7Count = 2
                If frmProfile4.cbT84Piece.Checked Then T8Count = 4 Else If frmProfile4.cbT82Piece.Checked Then T8Count = 2
                If frmProfile4.cbT94Piece.Checked Then T9Count = 4 Else If frmProfile4.cbT92Piece.Checked Then T9Count = 2
                If frmProfile4.cbT104Piece.Checked Then T10Count = 4 Else If frmProfile4.cbT102Piece.Checked Then T10Count = 2
        End Select
        EmberSkyflareDiamondCoef = 1 : BeamingEarthsiegeDiamondCoef = 1 : bInsightfulEarthsiegeDiamond = False : BaseCritCoef = 1.5
        Select Case sTemp
            Case "Ember Skyflare Diamond" : EmberSkyflareDiamondCoef = 1.02
            Case "Beaming Earthsiege Diamond" : BeamingEarthsiegeDiamondCoef = 1.02
            Case "Insightful Earthsiege Diamond" : bInsightfulEarthsiegeDiamond = True
            Case "Chaotic Skyflare Diamond" : BaseCritCoef *= 1.03
        End Select
        lTemp = 0 : lTemp2 = 0 : bShardoftheGods = False : bPurifiedShardoftheGods = False : bTwoMinTrinket = False : ShardoftheCrystalHeart = False : TalismanofResurgence = False
        ScaleofFates = False : LivingFlame = False : EnergySiphon = False : MeteoriteCrystal = False : TFofVolatilePower = False : TFofVolatilePowerHaste = 0 : TFofVolatilePowerText = "" : bEyeoftheBroodmother = False
        bIllustrationoftheDragonSoul = False : bDyingCurse = False : bElementalFocusStone = False : bFlareoftheHeavens = False : bPandorasPlea = False : bMoteofFlame = False
        bShardofFlame = False : bShowofFaith = False : bSifsRemembrance = False : bEmbraceoftheSpider = False : bSundialoftheExiled = False : bAbyssalRune = False : bMuradinsSpyglass = False
        bDislodgedForeignObject = False : MaghiasMisguidedQuill = False : bPurifiedLunarDust = False : bSliverofPureIce = False : bPhylacteryoftheNamelessLich = False
        For a = 1 To 0 Step -1
            If a = 1 Then sTemp = Trinket1 Else sTemp = Trinket2
            Select Case sTemp
                Case "Shard of the Crystal Heart" : HitRating += 128 : ShardoftheCrystalHeart = True : bTwoMinTrinket = True
                Case "Maghia's Misguided Quill" : HitRating += 152 : MaghiasMisguidedQuill = True : bTwoMinTrinket = True
                Case "Talisman of Resurgence" : Intellect += 128 : TalismanofResurgence = True : bTwoMinTrinket = True
                Case "Scale of Fates" : BonusDamage += 125 : ScaleofFates = True : bTwoMinTrinket = True
                Case "Living Flame" : HitRating += 107 : LivingFlame = True : bTwoMinTrinket = True
                Case "Energy Siphon" : GearMP5 += 54 : EnergySiphon = True : bTwoMinTrinket = True
                Case "Meteorite Crystal" : Intellect += 111 : MeteoriteCrystal = True : bTwoMinTrinket = True
                Case "Talisman of Volatile Power", "Fetish of Volatile Power" : CritRating += 114 : TFofVolatilePower = True : bTwoMinTrinket = True : If TFofVolatilePowerHaste = 0 Then TFofVolatilePowerHaste = 57
                Case "Talisman of Volatile Power (Heroic)", "Fetish of Volatile Power (Heroic)" : CritRating += 126 : TFofVolatilePower = True : bTwoMinTrinket = True : TFofVolatilePowerHaste = 64 : TFofVolatilePowerText = " (Heroic)"
                Case "Illustration of the Dragon Soul" : bIllustrationoftheDragonSoul = True
                Case "Eye of the Broodmother" : CritRating += 87 : bEyeoftheBroodmother = True
                Case "Dying Curse" : HitRating += 71 : bDyingCurse = True
                Case "Elemental Focus Stone" : HitRating += 108 : bElementalFocusStone = True
                Case "Flare of the Heavens" : CritRating += 120 : bFlareoftheHeavens = True
                Case "Pandora's Plea" : Intellect += 108 : bPandorasPlea = True
                Case "Reign of the Unliving/Dead" : BonusDamage += 150 : bMoteofFlame = True
                Case "Reign of the Unliving/Dead (Heroic)" : BonusDamage += 168 : bShardofFlame = True
                Case "Show of Faith" : BonusDamage += 140 : bShowofFaith = True
                Case "Sif's Remembrance" : BonusDamage += 110 : bSifsRemembrance = True
                Case "Embrace of the Spider" : BonusDamage += 98 : bEmbraceoftheSpider = True
                Case "Sundial of the Exiled" : CritRating += 84 : bSundialoftheExiled = True
                Case "Abyssal Rune" : HasteRating += 84 : bAbyssalRune = True
                Case "Purified Shard of the Flame" : lTemp += 1
                Case "Purified Shard of the Scale" : lTemp += 1 : GearMP5 += 85
                Case "Shiny Shard of the Flame" : lTemp2 += 1
                Case "Shiny Shard of the Scale" : lTemp2 += 1 : GearMP5 += 96
                Case "Muradin's Spyglass" : CritRating += 131 : MuradinsSpyglassSP = 18 : MuradinsSpyglassText = "" : bMuradinsSpyglass = True
                Case "Muradin's Spyglass (Heroic)" : CritRating += 152 : MuradinsSpyglassSP = 20 : MuradinsSpyglassText = " (Heroic)" : bMuradinsSpyglass = True
                Case "Dislodged Foreign Object" : HasteRating += 155 : DislodgedForeignObjectSP = 105 : DislodgedForeignObjectText = "" : bDislodgedForeignObject = True
                Case "Dislodged Foreign Object (Heroic)" : HasteRating += 170 : DislodgedForeignObjectSP = 121 : DislodgedForeignObjectText = " (Heroic)" : bDislodgedForeignObject = True
                Case "Purified Lunar Dust" : BonusDamage += 179 : bPurifiedLunarDust = True
                Case "Sliver of Pure Ice" : BonusDamage += 158 : SliverofPureIceMana = 1625 : bSliverofPureIce = True
                Case "Sliver of Pure Ice (Heroic)" : BonusDamage += 178 : SliverofPureIceMana = 1830 : bSliverofPureIce = True
                Case "Phylactery of the Nameless Lich" : CritRating += 152 : PhylacteryoftheNamelessLichSP = 1074 : PhylacteryoftheNamelessLichText = "" : bPhylacteryoftheNamelessLich = True
                Case "Phylactery of the Nameless Lich (Heroic)" : CritRating += 172 : PhylacteryoftheNamelessLichSP = 1207 : PhylacteryoftheNamelessLichText = " (Heroic)" : bPhylacteryoftheNamelessLich = True
            End Select
        Next
        If lTemp = 2 Then bShardoftheGods = True : bPurifiedShardoftheGods = True : BonusDamage += 222
        If lTemp2 = 2 Then bShardoftheGods = True : BonusDamage += 250
        bT72Piece = T7Count > 1 : If bT72Piece Then T72PieceCoef = 1.25 Else T72PieceCoef = 1
        If T7Count > 3 Then T74PiecePerc = 0.05 Else T74PiecePerc = 0
        bT82Piece = T8Count > 1
        bT84Piece = T8Count > 3
        bT92Piece = T9Count > 1
        If T9Count > 3 Then T94PiecePerc = 0.05 Else T94PiecePerc = 0
        T102PieceCoef = 1
        bT102Piece = T10Count > 1
        bT104Piece = T10Count > 3
        Select Case ProfileRunning
            Case 1 : bLightweave = frmProfile1.cbLightweave.Checked : bDarkglow = frmProfile1.cbDarkglow.Checked : bBlackMagic = frmProfile1.cbBlackMagic.Checked : bNibelung = frmProfile1.cbNibelung.Checked : bAshenBand = frmProfile1.cbAshenBand.Checked
            Case 2 : bLightweave = frmProfile2.cbLightweave.Checked : bDarkglow = frmProfile2.cbDarkglow.Checked : bBlackMagic = frmProfile2.cbBlackMagic.Checked : bNibelung = frmProfile2.cbNibelung.Checked : bAshenBand = frmProfile2.cbAshenBand.Checked
            Case 3 : bLightweave = frmProfile3.cbLightweave.Checked : bDarkglow = frmProfile3.cbDarkglow.Checked : bBlackMagic = frmProfile3.cbBlackMagic.Checked : bNibelung = frmProfile3.cbNibelung.Checked : bAshenBand = frmProfile3.cbAshenBand.Checked
            Case 4 : bLightweave = frmProfile4.cbLightweave.Checked : bDarkglow = frmProfile4.cbDarkglow.Checked : bBlackMagic = frmProfile4.cbBlackMagic.Checked : bNibelung = frmProfile4.cbNibelung.Checked : bAshenBand = frmProfile4.cbAshenBand.Checked
        End Select
        Select Case comboElixirFlask.Text
            Case "Flask of Chromatic Wonder" : Intellect += 18 : Spirit += 18 : If cbMixology.Checked Then Intellect += 4 : Spirit += 4
            Case "Flask of Distilled Wisdom" : Intellect += 65 : If cbMixology.Checked Then Intellect += 20
            Case "Flask of the Frost Wyrm" : BonusDamage += 125 : If cbMixology.Checked Then BonusDamage += 47
            Case "Flask of Pure Mojo" : GearMP5 += 45 : If cbMixology.Checked Then GearMP5 += 20
            Case "Adept's Elixir" : BonusDamage += 24 : CritRating += 24 : If cbMixology.Checked Then BonusDamage += 9 : CritRating += 9
            Case "Guru's Elixir" : Intellect += 20 : Spirit += 20 : If cbMixology.Checked Then Intellect += 8 : Spirit += 8
            Case "Spellpower Elixir" : BonusDamage += 58 : If cbMixology.Checked Then BonusDamage += 19
            Case "Elixir of Accuracy" : HitRating += 45 : If cbMixology.Checked Then HitRating += 16
            Case "Elixir of Deadly Strikes" : CritRating += 45 : If cbMixology.Checked Then CritRating += 16
            Case "Elixir of Draenic Wisdom" : Intellect += 30 : Spirit += 30 : If cbMixology.Checked Then Intellect += 8 : Spirit += 8
            Case "Elixir of Healing Power" : BonusDamage += 24 : Spirit += 24 : If cbMixology.Checked Then BonusDamage += 9 : Spirit += 9
            Case "Elixir of Lightning Speed" : HasteRating += 45 : If cbMixology.Checked Then HasteRating += 16
            Case "Elixir of Mighty Mageblood" : GearMP5 += 24 : If cbMixology.Checked Then GearMP5 += 6
            Case "Elixir of Mighty Thoughts" : Intellect += 45 : If cbMixology.Checked Then Intellect += 16
            Case "Elixir of Spirit" : Spirit += 50 : If cbMixology.Checked Then Spirit += 16
        End Select
        Select Case comboFood.Text
            Case "+16 MP5" : GearMP5 += 16
            Case "+46 Spell Power (Fish Feast)" : BonusDamage += 46
            Case "+40 Hit" : HitRating += 40
            Case "+40 Crit" : CritRating += 40
            Case "+40 Haste" : HasteRating += 40
            Case "+40 Spirit" : Spirit += 40
        End Select
        If cbKings.Checked Then
            KingsCoef = 1.1
        ElseIf cbDrumsofFallenKings.Checked Then
            KingsCoef = 1.08
        Else
            KingsCoef = 1
        End If
        bReplenishment = cbReplenishment.Checked
        If bReplenishment Then
            bEnduringWinter = False
        ElseIf EnduringWinterApplicationPerc > 0 Then
            bEnduringWinter = True
        Else
            bEnduringWinter = False
        End If
        bJoW = cbJoW.Checked
        If cbDemonicPact.Checked Then lTemp = CInt(Val(txtLocksSP.Text) * 0.1) Else lTemp = 0
        Select Case True
            Case lTemp > 281 : BonusDamage += lTemp
            Case cbToWSP.Checked : BonusDamage += 280
            Case lTemp > CInt(Int(144 * 1.15)) : BonusDamage += lTemp
            Case cbEnhFlametongue.Checked : BonusDamage += CInt(Int(144 * 1.15))
            Case lTemp > 144 : BonusDamage += lTemp
            Case cbFlametongue.Checked : BonusDamage += 144
            Case Else : BonusDamage += lTemp
        End Select
        If cbImpFelIntelligence.Checked Then
            lTemp = 53 : lTemp2 = 70
        ElseIf cbFelIntelligence.Checked Then
            lTemp = 48 : lTemp2 = 64
        End If
        If cbArcaneBrilliance.Checked Then lTemp = 60
        If cbDivineSpirit.Checked Then lTemp2 = 80
        Intellect += lTemp : Spirit += lTemp2
        If cbImpMotW.Checked Then
            Intellect += 52 : Spirit += 52
        ElseIf cbMotW.Checked Then
            Intellect += 37 : Spirit += 37
        ElseIf cbDrumsoftheWild.Checked Then
            Intellect += 37 : Spirit += 37
        End If
        If cbImpBoW.Checked Then GearMP5 += 109 Else If cbBoW.Checked Then GearMP5 += 91
        bMoltenArmor = cbMoltenArmor.Checked : If Not bMoltenArmor Then MoltenArmorPerc = 0 Else MoltenArmorPerc = 0.35 + GlyphofMoltenArmorPerc : If bT92Piece Then MoltenArmorPerc += 0.15
        If Not cbMageArmor.Checked Then MP5CastingPerc = 0 Else MP5CastingPerc = 0.5 : If bT92Piece Then MP5CastingPerc += 0.1
        MP5CastingPerc += ArcaneMeditationPerc + PyromaniacManaPerc : If MP5CastingPerc > 1 Then MP5CastingPerc = 1
        If cbCoE.Checked Then CoECoef = 1.13 Else CoECoef = 1
        If cbFISRAE.Checked Then
            FISRAECoef = 1.03
        ElseIf tArcaneEmpowerment > 0 Then
            FISRAECoef = 1.03
        Else
            FISRAECoef = 1
        End If
        HasteCoef = NetherwindPresenceCoef
        If cbImpMoonkin.Checked Then HasteCoef *= 1.03
        If cbWoA.Checked Then HasteCoef *= 1.05
        If cbFMOnYou.Checked Then BuffCritPerc = 0.03 Else BuffCritPerc = 0
        If bFocusMagic And cbFMOnTarget.Checked Then BuffCritPerc += 0.03
        If cbToWCrit.Checked Then BuffCritPerc += 0.03
        If cbMoonkin.Checked Then BuffCritPerc += 0.05
        If cbImpShadowBolt.Checked Then BuffCritPerc += 0.05 : bWintersChill = False : bScorch = False

        GlobalMissPerc(0) = PrecisionPerc
        If cbSPriest.Checked Then GlobalMissPerc(0) += 0.03
        If bHeroicPresence Then GlobalMissPerc(0) += 0.01

        GlobalDamageCoef(0) = ArcaneInstabilityCoef * PlayingWithFireCoef * CoECoef

        b4xABMBAM = False : b4xABAM = False : b3xABMBAM = False : b2xABMBAM = False
        Select Case ProfileRunning
            Case 1 : sTemp = frmProfile1.comboArcaneRotation.Text
            Case 2 : sTemp = frmProfile2.comboArcaneRotation.Text
            Case 3 : sTemp = frmProfile3.comboArcaneRotation.Text
            Case 4 : sTemp = frmProfile4.comboArcaneRotation.Text
        End Select
        Select Case sTemp
            Case "4xAB->MBAM (fishes)" : b4xABMBAM = True
            Case "4xAB->AM (locked)" : b4xABAM = True
            Case "3xAB->MBAM (fish to 4)" : b3xABMBAM = True
            Case "2xAB->MBAM (fish to 4)" : b2xABMBAM = True
        End Select

        frmBonusDamage = BonusDamage
        frmHitRating = HitRating
        frmCritRating = CritRating
        frmHasteRating = HasteRating
        GearMP5Original = GearMP5
        frmIntellect = Intellect
        frmSpirit = Spirit
        Application.DoEvents()

        bScorchFiller = False
        bFireBlast = False
        bFrostfireBolt = False
        bFireball = tImpFireball > 0
        bFrostbolt = tImpFrostbolt > 0
        bArcaneMissile = tMissileBarrage > 0
        bArcaneBlast = bArcaneMissile
        If Not bFireball And Not bFrostbolt And bIgnite And tPiercingIce > 0 Then bFrostfireBolt = True
        If Not (bArcaneBlast Or bFireball Or bFrostbolt Or bFrostfireBolt) Then
            If tImpFireBlast > 0 Then
                bFireBlast = True
                bScorchFiller = True
            Else
                bArcaneBlast = True : bArcaneMissile = True
            End If
        End If
        PhylacteryFireball = False : PhylacteryFrostfireBolt = False
        If bPhylacteryoftheNamelessLich And bArcaneMissile And bArcaneBlast Then If tIceShards > 0 Then PhylacteryFrostfireBolt = True
        If bPhylacteryoftheNamelessLich And bArcaneMissile And bArcaneBlast Then If tIceShards = 0 Then PhylacteryFireball = True
    End Sub
    Sub frmMage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cbDemonicPact.Checked = False
        comboElixirFlask.SelectedItem = "None"
        comboFood.SelectedItem = "None"
        Randomize()
        Me.Show()
        frmProfile1.Text = "Profile 1"
        frmProfile1.comboRace.SelectedItem = "Undead"
        frmProfile1.cbCookieCutter.Checked = True
        frmProfile1.comboCookieCutter.SelectedItem = "Arcane (0/3 SotM)"
        frmProfile1.comboTrinket1.SelectedItem = "None"
        frmProfile1.comboTrinket2.SelectedItem = "None"
        frmProfile1.comboMeta.SelectedItem = "Chaotic Skyflare Diamond"
        frmProfile1.comboArcaneRotation.SelectedItem = "4xAB->MBAM (fishes)"
        frmProfile2.Text = "Profile 2"
        frmProfile2.comboRace.SelectedItem = "Undead"
        frmProfile2.cbCookieCutter.Checked = True
        frmProfile2.comboCookieCutter.SelectedItem = "TtW Fireball (1/3 SotM)"
        frmProfile2.comboTrinket1.SelectedItem = "None"
        frmProfile2.comboTrinket2.SelectedItem = "None"
        frmProfile2.comboMeta.SelectedItem = "Chaotic Skyflare Diamond"
        frmProfile2.comboArcaneRotation.SelectedItem = "4xAB->MBAM (fishes)"
        frmProfile2.btnCopy1.Text = "Copy Profile 1"
        frmProfile2.btnCopy2.Text = "Copy Profile 3"
        frmProfile2.btnCopy3.Text = "Copy Profile 4"
        frmProfile3.Text = "Profile 3"
        frmProfile3.comboRace.SelectedItem = "Undead"
        frmProfile3.cbCookieCutter.Checked = True
        frmProfile3.comboCookieCutter.SelectedItem = "Frostfire (deep fire)"
        frmProfile3.comboTrinket1.SelectedItem = "None"
        frmProfile3.comboTrinket2.SelectedItem = "None"
        frmProfile3.comboMeta.SelectedItem = "Chaotic Skyflare Diamond"
        frmProfile3.comboArcaneRotation.SelectedItem = "4xAB->MBAM (fishes)"
        frmProfile3.btnCopy1.Text = "Copy Profile 1"
        frmProfile3.btnCopy2.Text = "Copy Profile 2"
        frmProfile3.btnCopy3.Text = "Copy Profile 4"
        frmProfile4.Text = "Profile 4"
        frmProfile4.comboRace.SelectedItem = "Undead"
        frmProfile4.cbCookieCutter.Checked = True
        frmProfile4.comboCookieCutter.SelectedItem = "Raid Frost"
        frmProfile4.comboTrinket1.SelectedItem = "None"
        frmProfile4.comboTrinket2.SelectedItem = "None"
        frmProfile4.comboMeta.SelectedItem = "Chaotic Skyflare Diamond"
        frmProfile4.comboArcaneRotation.SelectedItem = "4xAB->MBAM (fishes)"
        frmProfile4.btnCopy1.Text = "Copy Profile 1"
        frmProfile4.btnCopy2.Text = "Copy Profile 2"
        frmProfile4.btnCopy3.Text = "Copy Profile 3"
        LoadSettings() : Application.DoEvents()
    End Sub
    Sub LoadSettings()
        If File.Exists(My.Application.Info.DirectoryPath & "\settings" & ProgramVersion & ".ini") Then
            Dim oRead As New StreamReader(My.Application.Info.DirectoryPath & "\settings" & ProgramVersion & ".ini")
            If oRead.ReadLine = ProgramVersion Then
                cbMoltenArmor.Checked = CBool(oRead.ReadLine)
                cbMageArmor.Checked = CBool(oRead.ReadLine)
                cbArcaneBrilliance.Checked = CBool(oRead.ReadLine)
                cbDivineSpirit.Checked = CBool(oRead.ReadLine)
                cbFelIntelligence.Checked = CBool(oRead.ReadLine)
                cbImpFelIntelligence.Checked = CBool(oRead.ReadLine)
                cbMotW.Checked = CBool(oRead.ReadLine)
                cbImpMotW.Checked = CBool(oRead.ReadLine)
                cbKings.Checked = CBool(oRead.ReadLine)
                cbDrumsofFallenKings.Checked = CBool(oRead.ReadLine)
                cbDrumsoftheWild.Checked = CBool(oRead.ReadLine)
                cbFMOnTarget.Checked = CBool(oRead.ReadLine)
                cbFMOnYou.Checked = CBool(oRead.ReadLine)
                cbToWCrit.Checked = CBool(oRead.ReadLine)
                cbMoonkin.Checked = CBool(oRead.ReadLine)
                cbImpShadowBolt.Checked = CBool(oRead.ReadLine)
                cbSPriest.Checked = CBool(oRead.ReadLine)
                cbHeroicPresence.Checked = CBool(oRead.ReadLine)
                cbFISRAE.Checked = CBool(oRead.ReadLine)
                cbCoE.Checked = CBool(oRead.ReadLine)
                cbImpMoonkin.Checked = CBool(oRead.ReadLine)
                cbWoA.Checked = CBool(oRead.ReadLine)
                cbToWSP.Checked = CBool(oRead.ReadLine)
                cbFlametongue.Checked = CBool(oRead.ReadLine)
                cbEnhFlametongue.Checked = CBool(oRead.ReadLine)
                cbDemonicPact.Checked = CBool(oRead.ReadLine)
                txtLocksSP.Text = oRead.ReadLine
                cbReplenishment.Checked = CBool(oRead.ReadLine)
                cbBoW.Checked = CBool(oRead.ReadLine)
                cbImpBoW.Checked = CBool(oRead.ReadLine)
                cbJoW.Checked = CBool(oRead.ReadLine)
                cbMixology.Checked = CBool(oRead.ReadLine)
                comboElixirFlask.SelectedItem = oRead.ReadLine
                comboFood.SelectedItem = oRead.ReadLine
                cbTopMost.Checked = CBool(oRead.ReadLine)

                lblProfile1Spec.Text = oRead.ReadLine
                txtOverallDPSProfile1.Text = oRead.ReadLine
                txtHighestDPSProfile1.Text = oRead.ReadLine
                txtLowestDPSProfile1.Text = oRead.ReadLine
                txtAverageManaDumpProfile1.Text = oRead.ReadLine
                txtLongestManaDumpProfile1.Text = oRead.ReadLine
                txtShortestManaDumpProfile1.Text = oRead.ReadLine
                txtDamageManaDumpProfile1.Text = oRead.ReadLine
                txtTotalManaDumpsProfile1.Text = oRead.ReadLine
                txtUseEvocationFirstProfile1.Text = oRead.ReadLine
                txtManaConsumedSecondProfile1.Text = oRead.ReadLine
                txtManaGainedSecondProfile1.Text = oRead.ReadLine
                txtManaConsumedGainedProfile1.Text = oRead.ReadLine
                txt1DPSspProfile1.Text = oRead.ReadLine
                txt1DPSHitProfile1.Text = oRead.ReadLine
                txtHitSPRatioProfile1.Text = oRead.ReadLine
                txt1DPSCritProfile1.Text = oRead.ReadLine
                txtCritSPRatioProfile1.Text = oRead.ReadLine
                txt1DPSHasteProfile1.Text = oRead.ReadLine
                txtHasteSPRatioProfile1.Text = oRead.ReadLine
                txt1DPSIntellectProfile1.Text = oRead.ReadLine
                txtIntellectSPRatioProfile1.Text = oRead.ReadLine
                txtIntellectLongevityProfile1.Text = oRead.ReadLine
                txt1DPSSpiritProfile1.Text = oRead.ReadLine
                txtSpiritSPRatioProfile1.Text = oRead.ReadLine
                txtSpiritLongevityProfile1.Text = oRead.ReadLine
                frmProfile1.txtName.Text = oRead.ReadLine
                frmProfile1.txtRealm.Text = oRead.ReadLine
                frmProfile1.comboRace.SelectedItem = oRead.ReadLine
                frmProfile1.txtBonusDamage.Text = oRead.ReadLine
                frmProfile1.txtHitRating.Text = oRead.ReadLine
                frmProfile1.txtCritRating.Text = oRead.ReadLine
                frmProfile1.txtHasteRating.Text = oRead.ReadLine
                frmProfile1.txtManaRegen.Text = oRead.ReadLine
                frmProfile1.txtIntellect.Text = oRead.ReadLine
                frmProfile1.txtSpirit.Text = oRead.ReadLine
                frmProfile1.comboHead.Text = oRead.ReadLine
                frmProfile1.comboEnchantHead.Text = oRead.ReadLine
                frmProfile1.comboMeta.Text = oRead.ReadLine
                frmProfile1.comboNeck.Text = oRead.ReadLine
                frmProfile1.comboShoulder.Text = oRead.ReadLine
                frmProfile1.comboEnchantShoulder.Text = oRead.ReadLine
                frmProfile1.comboBack.Text = oRead.ReadLine
                frmProfile1.comboEnchantBack.Text = oRead.ReadLine
                frmProfile1.comboChest.Text = oRead.ReadLine
                frmProfile1.comboEnchantChest.Text = oRead.ReadLine
                frmProfile1.comboWrist.Text = oRead.ReadLine
                frmProfile1.comboEnchantWrist.Text = oRead.ReadLine
                frmProfile1.comboEnchantSocketWrist.Text = oRead.ReadLine
                frmProfile1.comboHands.Text = oRead.ReadLine
                frmProfile1.comboEnchantHands.Text = oRead.ReadLine
                frmProfile1.comboEnchantSocketHands.Text = oRead.ReadLine
                frmProfile1.comboWaist.Text = oRead.ReadLine
                frmProfile1.comboEnchantWaist.Text = oRead.ReadLine
                frmProfile1.comboLegs.Text = oRead.ReadLine
                frmProfile1.comboEnchantLegs.Text = oRead.ReadLine
                frmProfile1.comboFeet.Text = oRead.ReadLine
                frmProfile1.comboEnchantFeet.Text = oRead.ReadLine
                frmProfile1.comboFinger1.Text = oRead.ReadLine
                frmProfile1.comboEnchantFinger1.Text = oRead.ReadLine
                frmProfile1.comboFinger2.Text = oRead.ReadLine
                frmProfile1.comboEnchantFinger2.Text = oRead.ReadLine
                frmProfile1.comboTrinket1.Text = oRead.ReadLine
                frmProfile1.comboTrinket2.Text = oRead.ReadLine
                frmProfile1.comboMainHand.Text = oRead.ReadLine
                frmProfile1.comboEnchantMainHand.Text = oRead.ReadLine
                frmProfile1.comboOffHand.Text = oRead.ReadLine
                frmProfile1.comboWand.Text = oRead.ReadLine
                frmProfile1.comboArcaneRotation.Text = oRead.ReadLine
                frmProfile1.cbCookieCutter.Checked = CBool(oRead.ReadLine)
                frmProfile1.comboCookieCutter.SelectedItem = oRead.ReadLine
                frmProfile1.cbCustomSpec.Checked = CBool(oRead.ReadLine)
                frmProfile1.txtCustomSpec.Text = oRead.ReadLine
                frmProfile1.txtCustomSpecDescription.Text = oRead.ReadLine
                frmProfile1.comboGlyph1.SelectedItem = oRead.ReadLine
                frmProfile1.comboGlyph2.SelectedItem = oRead.ReadLine
                frmProfile1.comboGlyph3.SelectedItem = oRead.ReadLine
                frmProfile1.cbT72Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT74Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT82Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT84Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT92Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT94Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT102Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbT104Piece.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbBlackMagic.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbLightweave.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbDarkglow.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbNibelung.Checked = CBool(oRead.ReadLine)
                frmProfile1.cbAshenBand.Checked = CBool(oRead.ReadLine)

                lblProfile2Spec.Text = oRead.ReadLine
                txtOverallDPSProfile2.Text = oRead.ReadLine
                txtHighestDPSProfile2.Text = oRead.ReadLine
                txtLowestDPSProfile2.Text = oRead.ReadLine
                txtAverageManaDumpProfile2.Text = oRead.ReadLine
                txtLongestManaDumpProfile2.Text = oRead.ReadLine
                txtShortestManaDumpProfile2.Text = oRead.ReadLine
                txtDamageManaDumpProfile2.Text = oRead.ReadLine
                txtTotalManaDumpsProfile2.Text = oRead.ReadLine
                txtUseEvocationFirstProfile2.Text = oRead.ReadLine
                txtManaConsumedSecondProfile2.Text = oRead.ReadLine
                txtManaGainedSecondProfile2.Text = oRead.ReadLine
                txtManaConsumedGainedProfile2.Text = oRead.ReadLine
                txt1DPSspProfile2.Text = oRead.ReadLine
                txt1DPSHitProfile2.Text = oRead.ReadLine
                txtHitSPRatioProfile2.Text = oRead.ReadLine
                txt1DPSCritProfile2.Text = oRead.ReadLine
                txtCritSPRatioProfile2.Text = oRead.ReadLine
                txt1DPSHasteProfile2.Text = oRead.ReadLine
                txtHasteSPRatioProfile2.Text = oRead.ReadLine
                txt1DPSIntellectProfile2.Text = oRead.ReadLine
                txtIntellectSPRatioProfile2.Text = oRead.ReadLine
                txtIntellectLongevityProfile2.Text = oRead.ReadLine
                txt1DPSSpiritProfile2.Text = oRead.ReadLine
                txtSpiritSPRatioProfile2.Text = oRead.ReadLine
                txtSpiritLongevityProfile2.Text = oRead.ReadLine
                frmProfile2.txtName.Text = oRead.ReadLine
                frmProfile2.txtRealm.Text = oRead.ReadLine
                frmProfile2.comboRace.SelectedItem = oRead.ReadLine
                frmProfile2.txtBonusDamage.Text = oRead.ReadLine
                frmProfile2.txtHitRating.Text = oRead.ReadLine
                frmProfile2.txtCritRating.Text = oRead.ReadLine
                frmProfile2.txtHasteRating.Text = oRead.ReadLine
                frmProfile2.txtManaRegen.Text = oRead.ReadLine
                frmProfile2.txtIntellect.Text = oRead.ReadLine
                frmProfile2.txtSpirit.Text = oRead.ReadLine
                frmProfile2.comboHead.Text = oRead.ReadLine
                frmProfile2.comboEnchantHead.Text = oRead.ReadLine
                frmProfile2.comboMeta.Text = oRead.ReadLine
                frmProfile2.comboNeck.Text = oRead.ReadLine
                frmProfile2.comboShoulder.Text = oRead.ReadLine
                frmProfile2.comboEnchantShoulder.Text = oRead.ReadLine
                frmProfile2.comboBack.Text = oRead.ReadLine
                frmProfile2.comboEnchantBack.Text = oRead.ReadLine
                frmProfile2.comboChest.Text = oRead.ReadLine
                frmProfile2.comboEnchantChest.Text = oRead.ReadLine
                frmProfile2.comboWrist.Text = oRead.ReadLine
                frmProfile2.comboEnchantWrist.Text = oRead.ReadLine
                frmProfile2.comboEnchantSocketWrist.Text = oRead.ReadLine
                frmProfile2.comboHands.Text = oRead.ReadLine
                frmProfile2.comboEnchantHands.Text = oRead.ReadLine
                frmProfile2.comboEnchantSocketHands.Text = oRead.ReadLine
                frmProfile2.comboWaist.Text = oRead.ReadLine
                frmProfile2.comboEnchantWaist.Text = oRead.ReadLine
                frmProfile2.comboLegs.Text = oRead.ReadLine
                frmProfile2.comboEnchantLegs.Text = oRead.ReadLine
                frmProfile2.comboFeet.Text = oRead.ReadLine
                frmProfile2.comboEnchantFeet.Text = oRead.ReadLine
                frmProfile2.comboFinger1.Text = oRead.ReadLine
                frmProfile2.comboEnchantFinger1.Text = oRead.ReadLine
                frmProfile2.comboFinger2.Text = oRead.ReadLine
                frmProfile2.comboEnchantFinger2.Text = oRead.ReadLine
                frmProfile2.comboTrinket1.Text = oRead.ReadLine
                frmProfile2.comboTrinket2.Text = oRead.ReadLine
                frmProfile2.comboMainHand.Text = oRead.ReadLine
                frmProfile2.comboEnchantMainHand.Text = oRead.ReadLine
                frmProfile2.comboOffHand.Text = oRead.ReadLine
                frmProfile2.comboWand.Text = oRead.ReadLine
                frmProfile2.comboArcaneRotation.Text = oRead.ReadLine
                frmProfile2.cbCookieCutter.Checked = CBool(oRead.ReadLine)
                frmProfile2.comboCookieCutter.SelectedItem = oRead.ReadLine
                frmProfile2.cbCustomSpec.Checked = CBool(oRead.ReadLine)
                frmProfile2.txtCustomSpec.Text = oRead.ReadLine
                frmProfile2.txtCustomSpecDescription.Text = oRead.ReadLine
                frmProfile2.comboGlyph1.SelectedItem = oRead.ReadLine
                frmProfile2.comboGlyph2.SelectedItem = oRead.ReadLine
                frmProfile2.comboGlyph3.SelectedItem = oRead.ReadLine
                frmProfile2.cbT72Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT74Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT82Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT84Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT92Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT94Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT102Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbT104Piece.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbBlackMagic.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbLightweave.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbDarkglow.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbNibelung.Checked = CBool(oRead.ReadLine)
                frmProfile2.cbAshenBand.Checked = CBool(oRead.ReadLine)

                lblProfile3Spec.Text = oRead.ReadLine
                txtOverallDPSProfile3.Text = oRead.ReadLine
                txtHighestDPSProfile3.Text = oRead.ReadLine
                txtLowestDPSProfile3.Text = oRead.ReadLine
                txtAverageManaDumpProfile3.Text = oRead.ReadLine
                txtLongestManaDumpProfile3.Text = oRead.ReadLine
                txtShortestManaDumpProfile3.Text = oRead.ReadLine
                txtDamageManaDumpProfile3.Text = oRead.ReadLine
                txtTotalManaDumpsProfile3.Text = oRead.ReadLine
                txtUseEvocationFirstProfile3.Text = oRead.ReadLine
                txtManaConsumedSecondProfile3.Text = oRead.ReadLine
                txtManaGainedSecondProfile3.Text = oRead.ReadLine
                txtManaConsumedGainedProfile3.Text = oRead.ReadLine
                txt1DPSspProfile3.Text = oRead.ReadLine
                txt1DPSHitProfile3.Text = oRead.ReadLine
                txtHitSPRatioProfile3.Text = oRead.ReadLine
                txt1DPSCritProfile3.Text = oRead.ReadLine
                txtCritSPRatioProfile3.Text = oRead.ReadLine
                txt1DPSHasteProfile3.Text = oRead.ReadLine
                txtHasteSPRatioProfile3.Text = oRead.ReadLine
                txt1DPSIntellectProfile3.Text = oRead.ReadLine
                txtIntellectSPRatioProfile3.Text = oRead.ReadLine
                txtIntellectLongevityProfile3.Text = oRead.ReadLine
                txt1DPSSpiritProfile3.Text = oRead.ReadLine
                txtSpiritSPRatioProfile3.Text = oRead.ReadLine
                txtSpiritLongevityProfile3.Text = oRead.ReadLine
                frmProfile3.txtName.Text = oRead.ReadLine
                frmProfile3.txtRealm.Text = oRead.ReadLine
                frmProfile3.comboRace.SelectedItem = oRead.ReadLine
                frmProfile3.txtBonusDamage.Text = oRead.ReadLine
                frmProfile3.txtHitRating.Text = oRead.ReadLine
                frmProfile3.txtCritRating.Text = oRead.ReadLine
                frmProfile3.txtHasteRating.Text = oRead.ReadLine
                frmProfile3.txtManaRegen.Text = oRead.ReadLine
                frmProfile3.txtIntellect.Text = oRead.ReadLine
                frmProfile3.txtSpirit.Text = oRead.ReadLine
                frmProfile3.comboHead.Text = oRead.ReadLine
                frmProfile3.comboEnchantHead.Text = oRead.ReadLine
                frmProfile3.comboMeta.Text = oRead.ReadLine
                frmProfile3.comboNeck.Text = oRead.ReadLine
                frmProfile3.comboShoulder.Text = oRead.ReadLine
                frmProfile3.comboEnchantShoulder.Text = oRead.ReadLine
                frmProfile3.comboBack.Text = oRead.ReadLine
                frmProfile3.comboEnchantBack.Text = oRead.ReadLine
                frmProfile3.comboChest.Text = oRead.ReadLine
                frmProfile3.comboEnchantChest.Text = oRead.ReadLine
                frmProfile3.comboWrist.Text = oRead.ReadLine
                frmProfile3.comboEnchantWrist.Text = oRead.ReadLine
                frmProfile3.comboEnchantSocketWrist.Text = oRead.ReadLine
                frmProfile3.comboHands.Text = oRead.ReadLine
                frmProfile3.comboEnchantHands.Text = oRead.ReadLine
                frmProfile3.comboEnchantSocketHands.Text = oRead.ReadLine
                frmProfile3.comboWaist.Text = oRead.ReadLine
                frmProfile3.comboEnchantWaist.Text = oRead.ReadLine
                frmProfile3.comboLegs.Text = oRead.ReadLine
                frmProfile3.comboEnchantLegs.Text = oRead.ReadLine
                frmProfile3.comboFeet.Text = oRead.ReadLine
                frmProfile3.comboEnchantFeet.Text = oRead.ReadLine
                frmProfile3.comboFinger1.Text = oRead.ReadLine
                frmProfile3.comboEnchantFinger1.Text = oRead.ReadLine
                frmProfile3.comboFinger2.Text = oRead.ReadLine
                frmProfile3.comboEnchantFinger2.Text = oRead.ReadLine
                frmProfile3.comboTrinket1.Text = oRead.ReadLine
                frmProfile3.comboTrinket2.Text = oRead.ReadLine
                frmProfile3.comboMainHand.Text = oRead.ReadLine
                frmProfile3.comboEnchantMainHand.Text = oRead.ReadLine
                frmProfile3.comboOffHand.Text = oRead.ReadLine
                frmProfile3.comboWand.Text = oRead.ReadLine
                frmProfile3.comboArcaneRotation.Text = oRead.ReadLine
                frmProfile3.cbCookieCutter.Checked = CBool(oRead.ReadLine)
                frmProfile3.comboCookieCutter.SelectedItem = oRead.ReadLine
                frmProfile3.cbCustomSpec.Checked = CBool(oRead.ReadLine)
                frmProfile3.txtCustomSpec.Text = oRead.ReadLine
                frmProfile3.txtCustomSpecDescription.Text = oRead.ReadLine
                frmProfile3.comboGlyph1.SelectedItem = oRead.ReadLine
                frmProfile3.comboGlyph2.SelectedItem = oRead.ReadLine
                frmProfile3.comboGlyph3.SelectedItem = oRead.ReadLine
                frmProfile3.cbT72Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT74Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT82Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT84Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT92Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT94Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT102Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbT104Piece.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbBlackMagic.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbLightweave.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbDarkglow.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbNibelung.Checked = CBool(oRead.ReadLine)
                frmProfile3.cbAshenBand.Checked = CBool(oRead.ReadLine)

                lblProfile4Spec.Text = oRead.ReadLine
                txtOverallDPSProfile4.Text = oRead.ReadLine
                txtHighestDPSProfile4.Text = oRead.ReadLine
                txtLowestDPSProfile4.Text = oRead.ReadLine
                txtAverageManaDumpProfile4.Text = oRead.ReadLine
                txtLongestManaDumpProfile4.Text = oRead.ReadLine
                txtShortestManaDumpProfile4.Text = oRead.ReadLine
                txtDamageManaDumpProfile4.Text = oRead.ReadLine
                txtTotalManaDumpsProfile4.Text = oRead.ReadLine
                txtUseEvocationFirstProfile4.Text = oRead.ReadLine
                txtManaConsumedSecondProfile4.Text = oRead.ReadLine
                txtManaGainedSecondProfile4.Text = oRead.ReadLine
                txtManaConsumedGainedProfile4.Text = oRead.ReadLine
                txt1DPSspProfile4.Text = oRead.ReadLine
                txt1DPSHitProfile4.Text = oRead.ReadLine
                txtHitSPRatioProfile4.Text = oRead.ReadLine
                txt1DPSCritProfile4.Text = oRead.ReadLine
                txtCritSPRatioProfile4.Text = oRead.ReadLine
                txt1DPSHasteProfile4.Text = oRead.ReadLine
                txtHasteSPRatioProfile4.Text = oRead.ReadLine
                txt1DPSIntellectProfile4.Text = oRead.ReadLine
                txtIntellectSPRatioProfile4.Text = oRead.ReadLine
                txtIntellectLongevityProfile4.Text = oRead.ReadLine
                txt1DPSSpiritProfile4.Text = oRead.ReadLine
                txtSpiritSPRatioProfile4.Text = oRead.ReadLine
                txtSpiritLongevityProfile4.Text = oRead.ReadLine
                frmProfile4.txtName.Text = oRead.ReadLine
                frmProfile4.txtRealm.Text = oRead.ReadLine
                frmProfile4.comboRace.SelectedItem = oRead.ReadLine
                frmProfile4.txtBonusDamage.Text = oRead.ReadLine
                frmProfile4.txtHitRating.Text = oRead.ReadLine
                frmProfile4.txtCritRating.Text = oRead.ReadLine
                frmProfile4.txtHasteRating.Text = oRead.ReadLine
                frmProfile4.txtManaRegen.Text = oRead.ReadLine
                frmProfile4.txtIntellect.Text = oRead.ReadLine
                frmProfile4.txtSpirit.Text = oRead.ReadLine
                frmProfile4.comboHead.Text = oRead.ReadLine
                frmProfile4.comboEnchantHead.Text = oRead.ReadLine
                frmProfile4.comboMeta.Text = oRead.ReadLine
                frmProfile4.comboNeck.Text = oRead.ReadLine
                frmProfile4.comboShoulder.Text = oRead.ReadLine
                frmProfile4.comboEnchantShoulder.Text = oRead.ReadLine
                frmProfile4.comboBack.Text = oRead.ReadLine
                frmProfile4.comboEnchantBack.Text = oRead.ReadLine
                frmProfile4.comboChest.Text = oRead.ReadLine
                frmProfile4.comboEnchantChest.Text = oRead.ReadLine
                frmProfile4.comboWrist.Text = oRead.ReadLine
                frmProfile4.comboEnchantWrist.Text = oRead.ReadLine
                frmProfile4.comboEnchantSocketWrist.Text = oRead.ReadLine
                frmProfile4.comboHands.Text = oRead.ReadLine
                frmProfile4.comboEnchantHands.Text = oRead.ReadLine
                frmProfile4.comboEnchantSocketHands.Text = oRead.ReadLine
                frmProfile4.comboWaist.Text = oRead.ReadLine
                frmProfile4.comboEnchantWaist.Text = oRead.ReadLine
                frmProfile4.comboLegs.Text = oRead.ReadLine
                frmProfile4.comboEnchantLegs.Text = oRead.ReadLine
                frmProfile4.comboFeet.Text = oRead.ReadLine
                frmProfile4.comboEnchantFeet.Text = oRead.ReadLine
                frmProfile4.comboFinger1.Text = oRead.ReadLine
                frmProfile4.comboEnchantFinger1.Text = oRead.ReadLine
                frmProfile4.comboFinger2.Text = oRead.ReadLine
                frmProfile4.comboEnchantFinger2.Text = oRead.ReadLine
                frmProfile4.comboTrinket1.Text = oRead.ReadLine
                frmProfile4.comboTrinket2.Text = oRead.ReadLine
                frmProfile4.comboMainHand.Text = oRead.ReadLine
                frmProfile4.comboEnchantMainHand.Text = oRead.ReadLine
                frmProfile4.comboOffHand.Text = oRead.ReadLine
                frmProfile4.comboWand.Text = oRead.ReadLine
                frmProfile4.comboArcaneRotation.Text = oRead.ReadLine
                frmProfile4.cbCookieCutter.Checked = CBool(oRead.ReadLine)
                frmProfile4.comboCookieCutter.SelectedItem = oRead.ReadLine
                frmProfile4.cbCustomSpec.Checked = CBool(oRead.ReadLine)
                frmProfile4.txtCustomSpec.Text = oRead.ReadLine
                frmProfile4.txtCustomSpecDescription.Text = oRead.ReadLine
                frmProfile4.comboGlyph1.SelectedItem = oRead.ReadLine
                frmProfile4.comboGlyph2.SelectedItem = oRead.ReadLine
                frmProfile4.comboGlyph3.SelectedItem = oRead.ReadLine
                frmProfile4.cbT72Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT74Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT82Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT84Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT92Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT94Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT102Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbT104Piece.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbBlackMagic.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbLightweave.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbDarkglow.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbNibelung.Checked = CBool(oRead.ReadLine)
                frmProfile4.cbAshenBand.Checked = CBool(oRead.ReadLine)
                oRead.Close()
            End If
        End If
    End Sub
    Sub SaveSettings()
        Dim oWrite As New StreamWriter(My.Application.Info.DirectoryPath & "\settings" & ProgramVersion & ".ini")
        oWrite.WriteLine(ProgramVersion)
        oWrite.WriteLine(cbMoltenArmor.Checked)
        oWrite.WriteLine(cbMageArmor.Checked)
        oWrite.WriteLine(cbArcaneBrilliance.Checked)
        oWrite.WriteLine(cbDivineSpirit.Checked)
        oWrite.WriteLine(cbFelIntelligence.Checked)
        oWrite.WriteLine(cbImpFelIntelligence.Checked)
        oWrite.WriteLine(cbMotW.Checked)
        oWrite.WriteLine(cbImpMotW.Checked)
        oWrite.WriteLine(cbKings.Checked)
        oWrite.WriteLine(cbDrumsofFallenKings.Checked)
        oWrite.WriteLine(cbDrumsoftheWild.Checked)
        oWrite.WriteLine(cbFMOnTarget.Checked)
        oWrite.WriteLine(cbFMOnYou.Checked)
        oWrite.WriteLine(cbToWCrit.Checked)
        oWrite.WriteLine(cbMoonkin.Checked)
        oWrite.WriteLine(cbImpShadowBolt.Checked)
        oWrite.WriteLine(cbSPriest.Checked)
        oWrite.WriteLine(cbHeroicPresence.Checked)
        oWrite.WriteLine(cbFISRAE.Checked)
        oWrite.WriteLine(cbCoE.Checked)
        oWrite.WriteLine(cbImpMoonkin.Checked)
        oWrite.WriteLine(cbWoA.Checked)
        oWrite.WriteLine(cbToWSP.Checked)
        oWrite.WriteLine(cbFlametongue.Checked)
        oWrite.WriteLine(cbEnhFlametongue.Checked)
        oWrite.WriteLine(cbDemonicPact.Checked)
        oWrite.WriteLine(txtLocksSP.Text)
        oWrite.WriteLine(cbReplenishment.Checked)
        oWrite.WriteLine(cbBoW.Checked)
        oWrite.WriteLine(cbImpBoW.Checked)
        oWrite.WriteLine(cbJoW.Checked)
        oWrite.WriteLine(cbMixology.Checked)
        oWrite.WriteLine(comboElixirFlask.SelectedItem)
        oWrite.WriteLine(comboFood.SelectedItem)
        oWrite.WriteLine(cbTopMost.Checked)

        oWrite.WriteLine(lblProfile1Spec.Text)
        oWrite.WriteLine(txtOverallDPSProfile1.Text)
        oWrite.WriteLine(txtHighestDPSProfile1.Text)
        oWrite.WriteLine(txtLowestDPSProfile1.Text)
        oWrite.WriteLine(txtAverageManaDumpProfile1.Text)
        oWrite.WriteLine(txtLongestManaDumpProfile1.Text)
        oWrite.WriteLine(txtShortestManaDumpProfile1.Text)
        oWrite.WriteLine(txtDamageManaDumpProfile1.Text)
        oWrite.WriteLine(txtTotalManaDumpsProfile1.Text)
        oWrite.WriteLine(txtUseEvocationFirstProfile1.Text)
        oWrite.WriteLine(txtManaConsumedSecondProfile1.Text)
        oWrite.WriteLine(txtManaGainedSecondProfile1.Text)
        oWrite.WriteLine(txtManaConsumedGainedProfile1.Text)
        oWrite.WriteLine(txt1DPSspProfile1.Text)
        oWrite.WriteLine(txt1DPSHitProfile1.Text)
        oWrite.WriteLine(txtHitSPRatioProfile1.Text)
        oWrite.WriteLine(txt1DPSCritProfile1.Text)
        oWrite.WriteLine(txtCritSPRatioProfile1.Text)
        oWrite.WriteLine(txt1DPSHasteProfile1.Text)
        oWrite.WriteLine(txtHasteSPRatioProfile1.Text)
        oWrite.WriteLine(txt1DPSIntellectProfile1.Text)
        oWrite.WriteLine(txtIntellectSPRatioProfile1.Text)
        oWrite.WriteLine(txtIntellectLongevityProfile1.Text)
        oWrite.WriteLine(txt1DPSSpiritProfile1.Text)
        oWrite.WriteLine(txtSpiritSPRatioProfile1.Text)
        oWrite.WriteLine(txtSpiritLongevityProfile1.Text)
        oWrite.WriteLine(frmProfile1.txtName.Text)
        oWrite.WriteLine(frmProfile1.txtRealm.Text)
        oWrite.WriteLine(frmProfile1.comboRace.SelectedItem)
        oWrite.WriteLine(frmProfile1.txtBonusDamage.Text)
        oWrite.WriteLine(frmProfile1.txtHitRating.Text)
        oWrite.WriteLine(frmProfile1.txtCritRating.Text)
        oWrite.WriteLine(frmProfile1.txtHasteRating.Text)
        oWrite.WriteLine(frmProfile1.txtManaRegen.Text)
        oWrite.WriteLine(frmProfile1.txtIntellect.Text)
        oWrite.WriteLine(frmProfile1.txtSpirit.Text)
        oWrite.WriteLine(frmProfile1.comboHead.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantHead.Text)
        oWrite.WriteLine(frmProfile1.comboMeta.Text)
        oWrite.WriteLine(frmProfile1.comboNeck.Text)
        oWrite.WriteLine(frmProfile1.comboShoulder.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantShoulder.Text)
        oWrite.WriteLine(frmProfile1.comboBack.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantBack.Text)
        oWrite.WriteLine(frmProfile1.comboChest.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantChest.Text)
        oWrite.WriteLine(frmProfile1.comboWrist.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantWrist.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantSocketWrist.Text)
        oWrite.WriteLine(frmProfile1.comboHands.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantHands.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantSocketHands.Text)
        oWrite.WriteLine(frmProfile1.comboWaist.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantWaist.Text)
        oWrite.WriteLine(frmProfile1.comboLegs.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantLegs.Text)
        oWrite.WriteLine(frmProfile1.comboFeet.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantFeet.Text)
        oWrite.WriteLine(frmProfile1.comboFinger1.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantFinger1.Text)
        oWrite.WriteLine(frmProfile1.comboFinger2.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantFinger2.Text)
        oWrite.WriteLine(frmProfile1.comboTrinket1.Text)
        oWrite.WriteLine(frmProfile1.comboTrinket2.Text)
        oWrite.WriteLine(frmProfile1.comboMainHand.Text)
        oWrite.WriteLine(frmProfile1.comboEnchantMainHand.Text)
        oWrite.WriteLine(frmProfile1.comboOffHand.Text)
        oWrite.WriteLine(frmProfile1.comboWand.Text)
        oWrite.WriteLine(frmProfile1.comboArcaneRotation.Text)
        oWrite.WriteLine(frmProfile1.cbCookieCutter.Checked)
        oWrite.WriteLine(frmProfile1.comboCookieCutter.SelectedItem)
        oWrite.WriteLine(frmProfile1.cbCustomSpec.Checked)
        oWrite.WriteLine(frmProfile1.txtCustomSpec.Text)
        oWrite.WriteLine(frmProfile1.txtCustomSpecDescription.Text)
        oWrite.WriteLine(frmProfile1.comboGlyph1.SelectedItem)
        oWrite.WriteLine(frmProfile1.comboGlyph2.SelectedItem)
        oWrite.WriteLine(frmProfile1.comboGlyph3.SelectedItem)
        oWrite.WriteLine(frmProfile1.cbT72Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT74Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT82Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT84Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT92Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT94Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT102Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbT104Piece.Checked)
        oWrite.WriteLine(frmProfile1.cbBlackMagic.Checked)
        oWrite.WriteLine(frmProfile1.cbLightweave.Checked)
        oWrite.WriteLine(frmProfile1.cbDarkglow.Checked)
        oWrite.WriteLine(frmProfile1.cbNibelung.Checked)
        oWrite.WriteLine(frmProfile1.cbAshenBand.Checked)

        oWrite.WriteLine(lblProfile2Spec.Text)
        oWrite.WriteLine(txtOverallDPSProfile2.Text)
        oWrite.WriteLine(txtHighestDPSProfile2.Text)
        oWrite.WriteLine(txtLowestDPSProfile2.Text)
        oWrite.WriteLine(txtAverageManaDumpProfile2.Text)
        oWrite.WriteLine(txtLongestManaDumpProfile2.Text)
        oWrite.WriteLine(txtShortestManaDumpProfile2.Text)
        oWrite.WriteLine(txtDamageManaDumpProfile2.Text)
        oWrite.WriteLine(txtTotalManaDumpsProfile2.Text)
        oWrite.WriteLine(txtUseEvocationFirstProfile2.Text)
        oWrite.WriteLine(txtManaConsumedSecondProfile2.Text)
        oWrite.WriteLine(txtManaGainedSecondProfile2.Text)
        oWrite.WriteLine(txtManaConsumedGainedProfile2.Text)
        oWrite.WriteLine(txt1DPSspProfile2.Text)
        oWrite.WriteLine(txt1DPSHitProfile2.Text)
        oWrite.WriteLine(txtHitSPRatioProfile2.Text)
        oWrite.WriteLine(txt1DPSCritProfile2.Text)
        oWrite.WriteLine(txtCritSPRatioProfile2.Text)
        oWrite.WriteLine(txt1DPSHasteProfile2.Text)
        oWrite.WriteLine(txtHasteSPRatioProfile2.Text)
        oWrite.WriteLine(txt1DPSIntellectProfile2.Text)
        oWrite.WriteLine(txtIntellectSPRatioProfile2.Text)
        oWrite.WriteLine(txtIntellectLongevityProfile2.Text)
        oWrite.WriteLine(txt1DPSSpiritProfile2.Text)
        oWrite.WriteLine(txtSpiritSPRatioProfile2.Text)
        oWrite.WriteLine(txtSpiritLongevityProfile2.Text)
        oWrite.WriteLine(frmProfile2.txtName.Text)
        oWrite.WriteLine(frmProfile2.txtRealm.Text)
        oWrite.WriteLine(frmProfile2.comboRace.SelectedItem)
        oWrite.WriteLine(frmProfile2.txtBonusDamage.Text)
        oWrite.WriteLine(frmProfile2.txtHitRating.Text)
        oWrite.WriteLine(frmProfile2.txtCritRating.Text)
        oWrite.WriteLine(frmProfile2.txtHasteRating.Text)
        oWrite.WriteLine(frmProfile2.txtManaRegen.Text)
        oWrite.WriteLine(frmProfile2.txtIntellect.Text)
        oWrite.WriteLine(frmProfile2.txtSpirit.Text)
        oWrite.WriteLine(frmProfile2.comboHead.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantHead.Text)
        oWrite.WriteLine(frmProfile2.comboMeta.Text)
        oWrite.WriteLine(frmProfile2.comboNeck.Text)
        oWrite.WriteLine(frmProfile2.comboShoulder.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantShoulder.Text)
        oWrite.WriteLine(frmProfile2.comboBack.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantBack.Text)
        oWrite.WriteLine(frmProfile2.comboChest.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantChest.Text)
        oWrite.WriteLine(frmProfile2.comboWrist.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantWrist.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantSocketWrist.Text)
        oWrite.WriteLine(frmProfile2.comboHands.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantHands.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantSocketHands.Text)
        oWrite.WriteLine(frmProfile2.comboWaist.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantWaist.Text)
        oWrite.WriteLine(frmProfile2.comboLegs.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantLegs.Text)
        oWrite.WriteLine(frmProfile2.comboFeet.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantFeet.Text)
        oWrite.WriteLine(frmProfile2.comboFinger1.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantFinger1.Text)
        oWrite.WriteLine(frmProfile2.comboFinger2.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantFinger2.Text)
        oWrite.WriteLine(frmProfile2.comboTrinket1.Text)
        oWrite.WriteLine(frmProfile2.comboTrinket2.Text)
        oWrite.WriteLine(frmProfile2.comboMainHand.Text)
        oWrite.WriteLine(frmProfile2.comboEnchantMainHand.Text)
        oWrite.WriteLine(frmProfile2.comboOffHand.Text)
        oWrite.WriteLine(frmProfile2.comboWand.Text)
        oWrite.WriteLine(frmProfile2.comboArcaneRotation.Text)
        oWrite.WriteLine(frmProfile2.cbCookieCutter.Checked)
        oWrite.WriteLine(frmProfile2.comboCookieCutter.SelectedItem)
        oWrite.WriteLine(frmProfile2.cbCustomSpec.Checked)
        oWrite.WriteLine(frmProfile2.txtCustomSpec.Text)
        oWrite.WriteLine(frmProfile2.txtCustomSpecDescription.Text)
        oWrite.WriteLine(frmProfile2.comboGlyph1.SelectedItem)
        oWrite.WriteLine(frmProfile2.comboGlyph2.SelectedItem)
        oWrite.WriteLine(frmProfile2.comboGlyph3.SelectedItem)
        oWrite.WriteLine(frmProfile2.cbT72Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT74Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT82Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT84Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT92Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT94Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT102Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbT104Piece.Checked)
        oWrite.WriteLine(frmProfile2.cbBlackMagic.Checked)
        oWrite.WriteLine(frmProfile2.cbLightweave.Checked)
        oWrite.WriteLine(frmProfile2.cbDarkglow.Checked)
        oWrite.WriteLine(frmProfile2.cbNibelung.Checked)
        oWrite.WriteLine(frmProfile2.cbAshenBand.Checked)

        oWrite.WriteLine(lblProfile3Spec.Text)
        oWrite.WriteLine(txtOverallDPSProfile3.Text)
        oWrite.WriteLine(txtHighestDPSProfile3.Text)
        oWrite.WriteLine(txtLowestDPSProfile3.Text)
        oWrite.WriteLine(txtAverageManaDumpProfile3.Text)
        oWrite.WriteLine(txtLongestManaDumpProfile3.Text)
        oWrite.WriteLine(txtShortestManaDumpProfile3.Text)
        oWrite.WriteLine(txtDamageManaDumpProfile3.Text)
        oWrite.WriteLine(txtTotalManaDumpsProfile3.Text)
        oWrite.WriteLine(txtUseEvocationFirstProfile3.Text)
        oWrite.WriteLine(txtManaConsumedSecondProfile3.Text)
        oWrite.WriteLine(txtManaGainedSecondProfile3.Text)
        oWrite.WriteLine(txtManaConsumedGainedProfile3.Text)
        oWrite.WriteLine(txt1DPSspProfile3.Text)
        oWrite.WriteLine(txt1DPSHitProfile3.Text)
        oWrite.WriteLine(txtHitSPRatioProfile3.Text)
        oWrite.WriteLine(txt1DPSCritProfile3.Text)
        oWrite.WriteLine(txtCritSPRatioProfile3.Text)
        oWrite.WriteLine(txt1DPSHasteProfile3.Text)
        oWrite.WriteLine(txtHasteSPRatioProfile3.Text)
        oWrite.WriteLine(txt1DPSIntellectProfile3.Text)
        oWrite.WriteLine(txtIntellectSPRatioProfile3.Text)
        oWrite.WriteLine(txtIntellectLongevityProfile3.Text)
        oWrite.WriteLine(txt1DPSSpiritProfile3.Text)
        oWrite.WriteLine(txtSpiritSPRatioProfile3.Text)
        oWrite.WriteLine(txtSpiritLongevityProfile3.Text)
        oWrite.WriteLine(frmProfile3.txtName.Text)
        oWrite.WriteLine(frmProfile3.txtRealm.Text)
        oWrite.WriteLine(frmProfile3.comboRace.SelectedItem)
        oWrite.WriteLine(frmProfile3.txtBonusDamage.Text)
        oWrite.WriteLine(frmProfile3.txtHitRating.Text)
        oWrite.WriteLine(frmProfile3.txtCritRating.Text)
        oWrite.WriteLine(frmProfile3.txtHasteRating.Text)
        oWrite.WriteLine(frmProfile3.txtManaRegen.Text)
        oWrite.WriteLine(frmProfile3.txtIntellect.Text)
        oWrite.WriteLine(frmProfile3.txtSpirit.Text)
        oWrite.WriteLine(frmProfile3.comboHead.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantHead.Text)
        oWrite.WriteLine(frmProfile3.comboMeta.Text)
        oWrite.WriteLine(frmProfile3.comboNeck.Text)
        oWrite.WriteLine(frmProfile3.comboShoulder.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantShoulder.Text)
        oWrite.WriteLine(frmProfile3.comboBack.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantBack.Text)
        oWrite.WriteLine(frmProfile3.comboChest.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantChest.Text)
        oWrite.WriteLine(frmProfile3.comboWrist.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantWrist.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantSocketWrist.Text)
        oWrite.WriteLine(frmProfile3.comboHands.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantHands.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantSocketHands.Text)
        oWrite.WriteLine(frmProfile3.comboWaist.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantWaist.Text)
        oWrite.WriteLine(frmProfile3.comboLegs.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantLegs.Text)
        oWrite.WriteLine(frmProfile3.comboFeet.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantFeet.Text)
        oWrite.WriteLine(frmProfile3.comboFinger1.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantFinger1.Text)
        oWrite.WriteLine(frmProfile3.comboFinger2.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantFinger2.Text)
        oWrite.WriteLine(frmProfile3.comboTrinket1.Text)
        oWrite.WriteLine(frmProfile3.comboTrinket2.Text)
        oWrite.WriteLine(frmProfile3.comboMainHand.Text)
        oWrite.WriteLine(frmProfile3.comboEnchantMainHand.Text)
        oWrite.WriteLine(frmProfile3.comboOffHand.Text)
        oWrite.WriteLine(frmProfile3.comboWand.Text)
        oWrite.WriteLine(frmProfile3.comboArcaneRotation.Text)
        oWrite.WriteLine(frmProfile3.cbCookieCutter.Checked)
        oWrite.WriteLine(frmProfile3.comboCookieCutter.SelectedItem)
        oWrite.WriteLine(frmProfile3.cbCustomSpec.Checked)
        oWrite.WriteLine(frmProfile3.txtCustomSpec.Text)
        oWrite.WriteLine(frmProfile3.txtCustomSpecDescription.Text)
        oWrite.WriteLine(frmProfile3.comboGlyph1.SelectedItem)
        oWrite.WriteLine(frmProfile3.comboGlyph2.SelectedItem)
        oWrite.WriteLine(frmProfile3.comboGlyph3.SelectedItem)
        oWrite.WriteLine(frmProfile3.cbT72Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT74Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT82Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT84Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT92Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT94Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT102Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbT104Piece.Checked)
        oWrite.WriteLine(frmProfile3.cbBlackMagic.Checked)
        oWrite.WriteLine(frmProfile3.cbLightweave.Checked)
        oWrite.WriteLine(frmProfile3.cbDarkglow.Checked)
        oWrite.WriteLine(frmProfile3.cbNibelung.Checked)
        oWrite.WriteLine(frmProfile3.cbAshenBand.Checked)

        oWrite.WriteLine(lblProfile4Spec.Text)
        oWrite.WriteLine(txtOverallDPSProfile4.Text)
        oWrite.WriteLine(txtHighestDPSProfile4.Text)
        oWrite.WriteLine(txtLowestDPSProfile4.Text)
        oWrite.WriteLine(txtAverageManaDumpProfile4.Text)
        oWrite.WriteLine(txtLongestManaDumpProfile4.Text)
        oWrite.WriteLine(txtShortestManaDumpProfile4.Text)
        oWrite.WriteLine(txtDamageManaDumpProfile4.Text)
        oWrite.WriteLine(txtTotalManaDumpsProfile4.Text)
        oWrite.WriteLine(txtUseEvocationFirstProfile4.Text)
        oWrite.WriteLine(txtManaConsumedSecondProfile4.Text)
        oWrite.WriteLine(txtManaGainedSecondProfile4.Text)
        oWrite.WriteLine(txtManaConsumedGainedProfile4.Text)
        oWrite.WriteLine(txt1DPSspProfile4.Text)
        oWrite.WriteLine(txt1DPSHitProfile4.Text)
        oWrite.WriteLine(txtHitSPRatioProfile4.Text)
        oWrite.WriteLine(txt1DPSCritProfile4.Text)
        oWrite.WriteLine(txtCritSPRatioProfile4.Text)
        oWrite.WriteLine(txt1DPSHasteProfile4.Text)
        oWrite.WriteLine(txtHasteSPRatioProfile4.Text)
        oWrite.WriteLine(txt1DPSIntellectProfile4.Text)
        oWrite.WriteLine(txtIntellectSPRatioProfile4.Text)
        oWrite.WriteLine(txtIntellectLongevityProfile4.Text)
        oWrite.WriteLine(txt1DPSSpiritProfile4.Text)
        oWrite.WriteLine(txtSpiritSPRatioProfile4.Text)
        oWrite.WriteLine(txtSpiritLongevityProfile4.Text)
        oWrite.WriteLine(frmProfile4.txtName.Text)
        oWrite.WriteLine(frmProfile4.txtRealm.Text)
        oWrite.WriteLine(frmProfile4.comboRace.SelectedItem)
        oWrite.WriteLine(frmProfile4.txtBonusDamage.Text)
        oWrite.WriteLine(frmProfile4.txtHitRating.Text)
        oWrite.WriteLine(frmProfile4.txtCritRating.Text)
        oWrite.WriteLine(frmProfile4.txtHasteRating.Text)
        oWrite.WriteLine(frmProfile4.txtManaRegen.Text)
        oWrite.WriteLine(frmProfile4.txtIntellect.Text)
        oWrite.WriteLine(frmProfile4.txtSpirit.Text)
        oWrite.WriteLine(frmProfile4.comboHead.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantHead.Text)
        oWrite.WriteLine(frmProfile4.comboMeta.Text)
        oWrite.WriteLine(frmProfile4.comboNeck.Text)
        oWrite.WriteLine(frmProfile4.comboShoulder.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantShoulder.Text)
        oWrite.WriteLine(frmProfile4.comboBack.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantBack.Text)
        oWrite.WriteLine(frmProfile4.comboChest.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantChest.Text)
        oWrite.WriteLine(frmProfile4.comboWrist.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantWrist.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantSocketWrist.Text)
        oWrite.WriteLine(frmProfile4.comboHands.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantHands.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantSocketHands.Text)
        oWrite.WriteLine(frmProfile4.comboWaist.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantWaist.Text)
        oWrite.WriteLine(frmProfile4.comboLegs.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantLegs.Text)
        oWrite.WriteLine(frmProfile4.comboFeet.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantFeet.Text)
        oWrite.WriteLine(frmProfile4.comboFinger1.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantFinger1.Text)
        oWrite.WriteLine(frmProfile4.comboFinger2.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantFinger2.Text)
        oWrite.WriteLine(frmProfile4.comboTrinket1.Text)
        oWrite.WriteLine(frmProfile4.comboTrinket2.Text)
        oWrite.WriteLine(frmProfile4.comboMainHand.Text)
        oWrite.WriteLine(frmProfile4.comboEnchantMainHand.Text)
        oWrite.WriteLine(frmProfile4.comboOffHand.Text)
        oWrite.WriteLine(frmProfile4.comboWand.Text)
        oWrite.WriteLine(frmProfile4.comboArcaneRotation.Text)
        oWrite.WriteLine(frmProfile4.cbCookieCutter.Checked)
        oWrite.WriteLine(frmProfile4.comboCookieCutter.SelectedItem)
        oWrite.WriteLine(frmProfile4.cbCustomSpec.Checked)
        oWrite.WriteLine(frmProfile4.txtCustomSpec.Text)
        oWrite.WriteLine(frmProfile4.txtCustomSpecDescription.Text)
        oWrite.WriteLine(frmProfile4.comboGlyph1.SelectedItem)
        oWrite.WriteLine(frmProfile4.comboGlyph2.SelectedItem)
        oWrite.WriteLine(frmProfile4.comboGlyph3.SelectedItem)
        oWrite.WriteLine(frmProfile4.cbT72Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT74Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT82Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT84Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT92Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT94Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT102Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbT104Piece.Checked)
        oWrite.WriteLine(frmProfile4.cbBlackMagic.Checked)
        oWrite.WriteLine(frmProfile4.cbLightweave.Checked)
        oWrite.WriteLine(frmProfile4.cbDarkglow.Checked)
        oWrite.WriteLine(frmProfile4.cbNibelung.Checked)
        oWrite.WriteLine(frmProfile4.cbAshenBand.Checked)
        oWrite.Close()
    End Sub
    Private Sub cbMageArmor_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbMageArmor.CheckedChanged
        If cbMageArmor.Checked Then cbMoltenArmor.Checked = False
    End Sub
    Private Sub cbMoltenArmor_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbMoltenArmor.CheckedChanged
        If cbMoltenArmor.Checked Then cbMageArmor.Checked = False
    End Sub
    Private Sub cbDemonicPact_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbDemonicPact.CheckedChanged
        If cbDemonicPact.Checked Then txtLocksSP.Enabled = True Else txtLocksSP.Enabled = False
    End Sub
    Private Sub btnDetailsProfile4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProfile4Details.Click
        If File.Exists(My.Application.Info.DirectoryPath & "\Profile 4 " & ProgramVersion & ".txt") Then Shell("notepad " & My.Application.Info.DirectoryPath & "\Profile 4 " & ProgramVersion & ".txt", vbNormalFocus)
    End Sub
    Private Sub btnDetailsProfile3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProfile3Details.Click
        If File.Exists(My.Application.Info.DirectoryPath & "\Profile 3 " & ProgramVersion & ".txt") Then Shell("notepad " & My.Application.Info.DirectoryPath & "\Profile 3 " & ProgramVersion & ".txt", vbNormalFocus)
    End Sub
    Private Sub btnDetailsProfile2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProfile2Details.Click
        If File.Exists(My.Application.Info.DirectoryPath & "\Profile 2 " & ProgramVersion & ".txt") Then Shell("notepad " & My.Application.Info.DirectoryPath & "\Profile 2 " & ProgramVersion & ".txt", vbNormalFocus)
    End Sub
    Private Sub btnDetailsProfile1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProfile1Details.Click
        If File.Exists(My.Application.Info.DirectoryPath & "\Profile 1 " & ProgramVersion & ".txt") Then Shell("notepad " & My.Application.Info.DirectoryPath & "\Profile 1 " & ProgramVersion & ".txt", vbNormalFocus)
    End Sub
    Sub CalcMissPerc()
        GlobalMissPerc(1) = 0.17 - (HitRating / 26.23199272 / 100 + GlobalMissPerc(0))
        ArcaneBlastMissPerc = GlobalMissPerc(1) - ArcaneFocusPerc
        ArcaneMissileMissPerc = GlobalMissPerc(1) - ArcaneFocusPerc
        DeepFreezeMissPerc = GlobalMissPerc(1)
        FireballMissPerc = GlobalMissPerc(1)
        FireBlastMissPerc = GlobalMissPerc(1)
        FrostboltMissPerc = GlobalMissPerc(1)
        FrostfireBoltMissPerc = GlobalMissPerc(1)
        IceLanceMissPerc = GlobalMissPerc(1)
        LivingBombMissPerc = GlobalMissPerc(1)
        PyroblastMissPerc = GlobalMissPerc(1)
        ScorchMissPerc = GlobalMissPerc(1)
        WaterboltMissPerc = GlobalMissPerc(1)
    End Sub
    Sub CalcMana()
        ArcaneBlastMana(1) = CInt(ArcaneBlastMana(0) * ArcanePowerCoef)
        ArcaneBlastMoERefund = BaseMana * 0.07 * MasterofElementsPerc
        ArcaneMissileMana = CInt(BaseMana * 0.31 * (1 - PrecisionPerc) * (1 - ArcaneFocusPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef)
        ArcaneMissileMoERefund = BaseMana * 0.31 * MasterofElementsPerc
        DeepFreezeMana = CInt(Int(BaseMana * 0.09 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        DeepFreezeMoERefund = BaseMana * 0.09 * MasterofElementsPerc
        FireballMana = CInt(Int(BaseMana * 0.19 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        FireballMoERefund = BaseMana * 0.19 * MasterofElementsPerc
        FireBlastMana = CInt(Int(BaseMana * 0.21 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        FireBlastMoERefund = BaseMana * 0.21 * MasterofElementsPerc
        FrostboltMana = CInt(Int(BaseMana * 0.13 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        FrostboltMoERefund = BaseMana * 0.13 * MasterofElementsPerc
        FrostfireBoltMana = CInt(Int(BaseMana * 0.14 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        FrostfireBoltMoERefund = BaseMana * 0.14 * MasterofElementsPerc
        IceLanceMana = CInt(Int(BaseMana * 0.06 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        IceLanceMoERefund = BaseMana * 0.06 * MasterofElementsPerc
        IcyVeinsMana = CInt(Int(BaseMana * 0.03 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc)))
        MirrorImagesMana = CInt(Int(BaseMana * 0.1 * (1 - PrecisionPerc) * (1 - ArcaneFocusPerc) * (1 - FrostChannelingPerc)))
        LivingBombMana = CInt(Int(BaseMana * 0.22 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        LivingBombMoERefund = BaseMana * 0.22 * MasterofElementsPerc
        ScorchMana = CInt(Int(BaseMana * 0.08 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        ScorchMoERefund = BaseMana * 0.08 * MasterofElementsPerc
        PyroblastMana = CInt(Int(BaseMana * 0.22 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc) * ArcanePowerCoef))
        PyroblastMoERefund = BaseMana * 0.22 * MasterofElementsPerc
        SummonWaterElementalMana = CInt(Int(BaseMana * 0.16 * (1 - PrecisionPerc) * (1 - FrostChannelingPerc)))
        WaterboltMana = 32 : WaterElementalMaxMana = CInt(2905 + Intellect * 1.4885) : WaterElementalReplenishmentValue = WaterElementalMaxMana * 0.002
    End Sub
    Sub CalcCastTimes()
        If bArcaneMissile Then ArcaneMissileDuration = CInt(500 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : ArcaneMissileMBDuration = CInt(250 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef))
        If bArcaneBlast Then ArcaneBlastDuration = CInt(250 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : LongestSpell = ArcaneBlastDuration
        If bFireball OrElse PhylacteryFireball Then FireballDuration = CInt(FireballBaseCast / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : LongestSpell = FireballDuration
        If bScorch Then ScorchDuration = CInt(150 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef))
        If bFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBoltDuration = CInt(300 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : LongestSpell = FrostfireBoltDuration
        If bFrostbolt Then FrostboltDuration = CInt(FrostboltBaseCast / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : LongestSpell = FrostboltDuration
        If bWaterElemental Then WaterboltDuration(0) = CInt(250 / HasteCoef) - 1
        If bNibelung Then ValkyrGCD = CInt(135 / HasteCoef) - 1 : If ValkyrGCD < 100 Then ValkyrGCD = 100
        EvocationDuration = CInt(800 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : GCDDuration(0) = CInt(150 / (((HasteRating / 32.78998947) / 100 + 1) * HasteCoef * IcyVeinsCoef * BerserkingCoef * T102PieceCoef)) : If GCDDuration(0) < 100 Then GCDDuration(0) = 100
    End Sub
    Sub CalcCritCoef()
        If bArcaneBlast Then ArcaneBlastCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
        If bArcaneMissile Then ArcaneMissileCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc + GlyphofArcaneMissilePerc)
        If bDeepFreeze Then DeepFreezeCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + IceShardsPerc + T74PiecePerc)
        If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then FireballCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
        If bFireBlast Then FireBlastCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
        If bFrostbolt Then FrostboltCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + IceShardsPerc + T74PiecePerc)
        If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBoltCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + IceShardsPerc + T74PiecePerc)
        If bIceLance Then IceLanceCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + IceShardsPerc + T74PiecePerc)
        If bLivingBomb Then LivingBombCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
        If bPyroblast Then PyroblastCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
        If bScorch Then ScorchCritCoef = 1 + (BaseCritCoef - 1) * (1 + SpellPowerPerc + CombustionDamagePerc + BurnoutCritPerc + T74PiecePerc)
    End Sub
    Sub CalcCritPerc()
        GearCritPerc = ((Intellect / 166.6667 + 0.91) + ((CritRating + Spirit * MoltenArmorPerc) / 45.90598679)) / 100
        GlobalCritPerc = GearCritPerc + BuffCritPerc + ArcaneInstabilityCoef - 1 + PyromaniacCritPerc + CombustionCritPerc + ArcanePotencyPerc(1) + ScorchDebuffPerc + WintersChillDebuffPerc + ShatterCritPerc(1)
        If bArcaneBlast Then ArcaneBlastCritPerc = GlobalCritPerc + IncinerationPerc + T94PiecePerc
        If bArcaneMissile Then ArcaneMissileCritPerc = GlobalCritPerc + T94PiecePerc
        If bDeepFreeze Then DeepFreezeCritPerc = GlobalCritPerc
        If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then FireballCritPerc = GlobalCritPerc + ImpScorchCritPerc + CriticalMassPerc + GlyphofFireballPerc + T94PiecePerc
        If bFireBlast Then FireBlastCritPerc = GlobalCritPerc + CriticalMassPerc + IncinerationPerc
        If bFrostbolt Then FrostboltCritPerc = GlobalCritPerc + WintersChillFrostboltCritPerc + T94PiecePerc
        If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBoltCritPerc = GlobalCritPerc + ImpScorchCritPerc + GlyphofFrostfireCoef - 1 + T94PiecePerc
        If bIceLance Then IceLanceCritPerc = GlobalCritPerc
        If bLivingBomb Then LivingBombCritPerc = GlobalCritPerc + CriticalMassPerc + WorldinFlamesPerc
        If bPyroblast Then PyroblastCritPerc = GlobalCritPerc + CriticalMassPerc + WorldinFlamesPerc
        If bScorch Then ScorchCritPerc = GlobalCritPerc + ImpScorchCritPerc + CriticalMassPerc + IncinerationPerc
        If bWaterElemental Then WaterboltCritPerc = 0.05 + ScorchDebuffPerc + WintersChillDebuffPerc + BuffCritPerc
        If bNibelung Then ValkyrCritPerc = 0.05 + ScorchDebuffPerc + WintersChillDebuffPerc + BuffCritPerc
    End Sub
    Sub CalcDamageCoef()
        GlobalDamageCoef(1) = GlobalDamageCoef(0) * FISRAECoef * ArcanePowerCoef
        If bArcaneBlast Then ArcaneBlastDamageCoef = GlobalDamageCoef(1) * SpellImpactCoef * TormenttheWeakCoef
        If bArcaneMissile Then ArcaneMissileDamageCoef = GlobalDamageCoef(1) * TormenttheWeakCoef
        If bDeepFreeze Then DeepFreezeDamageCoef = GlobalDamageCoef(1) * PiercingIceCoef * ArcticWindsCoef
        If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then FireballDamageCoef = GlobalDamageCoef(1) * (FirePowerCoef + SpellImpactCoef - 1) * TormenttheWeakCoef : If bFireballDoT Then FireballDoTDamage = 29 * GlobalDamageCoef(1) * FirePowerCoef * TormenttheWeakCoef
        If bFireBlast Then FireBlastDamageCoef = GlobalDamageCoef(1) * (FirePowerCoef + SpellImpactCoef - 1)
        If bFrostbolt Then FrostboltDamageCoef = GlobalDamageCoef(1) * PiercingIceCoef * ArcticWindsCoef * (ChilledtotheBoneCoef + GlyphofFrostboltCoef - 1) * TormenttheWeakCoef
        If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBoltDamageCoef = GlobalDamageCoef(1) * FirePowerCoef * PiercingIceCoef * ArcticWindsCoef * ChilledtotheBoneCoef * GlyphofFrostfireCoef * TormenttheWeakCoef : FrostfireBoltDoTDamage = 30 * GlobalDamageCoef(1) * FirePowerCoef * PiercingIceCoef * ArcticWindsCoef * TormenttheWeakCoef
        If bIceLance Then IceLanceDamageCoef = GlobalDamageCoef(1) * PiercingIceCoef * ArcticWindsCoef * ChilledtotheBoneCoef * SpellImpactCoef * IceLanceFrozenCoef
        If bLivingBomb Then LivingBombDamageCoef = GlobalDamageCoef(1) * FirePowerCoef : LivingBombDamage = LivingBombBonusDamage * LivingBombDamageCoef : LivingBombDoTDamage = LivingBombDoTBonusDamage * LivingBombDamageCoef : If bGlyphofLivingBomb Then LivingBombDoTCritDamage = LivingBombDoTDamage * LivingBombCritCoef
        If bPyroblast Then PyroblastDamageCoef = GlobalDamageCoef(1) * FirePowerCoef * TormenttheWeakCoef
        If bScorch Then ScorchDamageCoef = GlobalDamageCoef(1) * (FirePowerCoef + SpellImpactCoef - 1 + GlyphofScorchCoef - 1)
        If bWaterElemental Then WaterboltDamageCoef = CoECoef * FISRAECoef
        If bNibelung Then ValkyrDamageCoef = CoECoef
    End Sub
    Sub CalcBonusDamage()
        If bArcaneBlast Then ArcaneBlastBonusDamage = 1185 + BonusDamage * ArcaneBlastBonusDamageCoef
        If bArcaneMissile Then ArcaneMissileBonusDamage = 362 + BonusDamage * ArcaneMissileBonusDamageCoef
        If bDeepFreeze Then DeepFreezeBonusDamage = 2369 + BonusDamage * DeepFreezeBonusDamageCoef
        If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then FireballBonusDamage = 898 + BonusDamage * FireballBonusDamageCoef
        If bFireBlast Then FireBlastBonusDamage = 925 + BonusDamage * FireBlastBonusDamageCoef
        If bFrostbolt Then FrostboltBonusDamage = 803 + BonusDamage * FrostboltBonusDamageCoef
        If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBoltBonusDamage = 722 + BonusDamage * FrostfireBoltBonusDamageCoef
        If bIceLance Then IceLanceBonusDamage = 223 + BonusDamage * IceLanceBonusDamageCoef
        If bLivingBomb Then LivingBombBonusDamage = 690 + BonusDamage * LivingBombBonusDamageCoef : LivingBombDoTBonusDamage = 345 + BonusDamage * LivingBombDoTBonusDamageCoef
        If bPyroblast Then PyroblastBonusDamage = 1210 + BonusDamage * PyroblastBonusDamageCoef : PyroblastDoTBonusDamage = 113 + BonusDamage * PyroblastDoTBonusDamageCoef
        If bScorch Then ScorchBonusDamage = 382 + BonusDamage * ScorchBonusDamageCoef
        If bWaterElemental Then WaterboltBonusDamage = 601 + BonusDamage * WaterBoltBonusDamageCoef
    End Sub
    Sub frmMage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        If Not bOoM Then e.Cancel = True Else If File.Exists(My.Application.Info.DirectoryPath & "\NULL" & ProgramVersion & ".NULL") Then File.Delete(My.Application.Info.DirectoryPath & "\NULL" & ProgramVersion & ".NULL")
    End Sub
    Sub AddMana(ByVal Value As Integer)
        Mana += Value : ManaGained += Value : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
    End Sub
    Sub MageEngine()
        If Not bCreateLog Then sLog = My.Application.Info.DirectoryPath & "\NULL" & ProgramVersion & ".NULL"
        Dim oLog As New StreamWriter(sLog)

        TwoMinTrinket = False : TwoMinTrinketStart = -99999 : TFofVolatilePowerStack = 0 : MeteoriteCrystalStack = 0
        IllustrationoftheDragonSoul = False : IllustrationoftheDragonSoulStack = 0 : IllustrationoftheDragonSoulStart = -99999
        EyeoftheBroodmother = False : EyeoftheBroodmotherStack = 0 : EyeoftheBroodmotherStart = -99999
        MuradinsSpyglass = False : MuradinsSpyglassStack = 0 : MuradinsSpyglassStart = -99999
        DyingCurse = False : DyingCurseStart = -99999
        ElementalFocusStone = False : ElementalFocusStoneStart = -99999
        FlareoftheHeavens = False : FlareoftheHeavensStart = -99999
        PandorasPlea = False : PandorasPleaStart = -99999
        MoteofFlame = False : MoteofFlameStart = -99999 : MoteofFlameStack = 0
        ShardofFlame = False : ShardofFlameStart = -99999 : ShardofFlameStack = 0
        PurifiedLunarDust = False : PurifiedLunarDustStart = -99999
        ShowofFaith = False : ShowofFaithStart = -99999
        SifsRemembrance = False : SifsRemembranceStart = -99999
        EmbraceoftheSpider = False : EmbraceoftheSpiderStart = -99999
        SundialoftheExiled = False : SundialoftheExiledStart = -99999
        AbyssalRune = False : AbyssalRuneStart = -99999
        ShardoftheGods = False
        ShinyShardoftheGods = False
        PurifiedShardoftheGods = False : ShardoftheGodsStart = -99999
        DislodgedForeignObject = False : SurgeofPowerStart = -99999 : SurgingPowerStack = 0
        SliverofPureIce = False : SliverofPureIceStart = -99999
        PhylacteryoftheNamelessLich = False : PhylacteryoftheNamelessLichStart = -99999
        Lightweave = False : LightweaveStart = -99999
        Darkglow = False : DarkglowStart = -99999
        AshenBand = False : AshenBandStart = -99999
        For a = 1 To 30 : Valkyr(a) = False : Next : ValkyrTally = 0
        InsightfulEarthsiegeDiamondStart = -99999
        BlackMagic = False : BlackMagicStart = -99999
        T72Piece = False
        T82Piece = False : T82PieceStart = -99999
        T84Piece = False
        T102Piece = False : T102PieceStart = -99999 : T102PieceCoef = 1
        T104Piece = False : T104PieceStart = -99999 : T104PieceCoef = 1
        Berserking = False : BerserkingStart = -99999 : BerserkingCoef = 1
        ArcaneTorrentStart = -99999

        MissileBarrage = False : TimetoReactMissileBarrage = False
        DeepFreezeStart = -99999
        FireBlastStart = -99999
        Pyroblast = False : PyroblastDoT = False
        LivingBomb = False
        Waterbolt = False : WaterboltStart = -99999 : WaterElementalServerLag = 0 : WaterElementalStart = -99999 : WaterElementalCDStart = -99999
        If bWaterElemental Then If Not bGlyphofEternalWater Then WaterElemental = False Else WaterElemental = True : WaterElementalMana = WaterElementalMaxMana
        FingersofFrost = False : ShatterCritPerc(1) = 0 : FingersofFrostStart = 99999 : FingersofFrostEnd = -99999 : FingersofFrostCount = 0 : FingersofFrostPerceivedCount = 0
        BrainFreeze = False : TimetoReactBrainFreeze = 99999 : FrostfireBoltCanProcBrainFreeze = True
        Ignite = False : IgnitePool = 0
        Combustion = False : CombustionEnd = -99999 : CombustionDamagePerc = 0 : CombustionCritPerc = 0 : CombustionCount = 0 : PerceivedCombustionCount = 0
        HotStreak = False : HotStreakStart(1) = -99999 : HotStreakCount = 0
        PresenceofMind = False : PresenceofMindEnd = -99999
        ColdSnapStart = -99999
        WintersChill = False : WintersChillDebuffStack = 0 : WintersChillDebuffPerc = 0
        Clearcasting = False : ClearcastingStart = -99999
        ArcanePotency = False : ArcanePotencyPerc(1) = 0
        IcyVeins = False : IcyVeinsCDStart = -99999 : IcyVeinsStart = -99999 : IcyVeinsCoef = 1
        ArcanePower = False : ArcanePowerStart = -99999 : ArcanePowerCoef = 1
        EnduringWinter = False : EnduringWinterStart = -99999

        ArcaneBlastStack = False : ArcaneBlastStackCount = 0 : ArcaneBlastPerceivedStackCount = 0 : ArcaneBlastStackStart = -99999
        ArcaneMissile = False : ArcaneMissileArcaneBlastStack = 0 : ArcaneMissileFlightStart(1) = 999999 : ArcaneMissileFlightStart(2) = 999999 : ArcaneMissileFlightStart(3) = 999999 : ArcaneMissileFlightStart(4) = 999999 : ArcaneMissileFlightStart(5) = 999999 : ArcaneMissileFireTracker = 1 : ArcaneMissileLandTracker = 1
        Fireball = False : FireballDoT = False
        Scorch = False : ScorchDebuffPerc = 0 : TimetoReactScorch = True
        FrostfireBolt(0) = False : FrostfireBolt(1) = False : FrostfireBoltDoT = False : WhichFrostfireBolt = 0
        Frostbolt = False
        IceLance = False

        HitRating = frmHitRating + HitRatingAdjust : CritRating = frmCritRating + CritRatingAdjust : HasteRating = frmHasteRating + HasteRatingAdjust
        'Intellect = CInt(Int((179 + frmIntellect + IntellectAdjust) * ArcaneMindCoef * GnomeCoef * EmberSkyflareDiamondCoef * KingsCoef))
        Intellect = CInt(Int((frmIntellect + IntellectAdjust) * ArcaneMindCoef * GnomeCoef * EmberSkyflareDiamondCoef * KingsCoef))
        'Spirit = CInt(Int((186 + frmSpirit + SpiritAdjust) * StudentoftheMindCoef * HumanCoef * KingsCoef))
        Spirit = CInt(Int((frmSpirit + SpiritAdjust) * StudentoftheMindCoef * HumanCoef * KingsCoef))
        BonusDamage = frmBonusDamage + BonusDamageAdjust + CInt(Int(Intellect * MindMasteryPerc))
        StatMP5 = CInt(Int(5 * (0.001 + Sqrt(Intellect) * Spirit * 0.005575) * 0.6))
        If Intellect > 19 Then MaxMana = CInt(Int((BaseMana + 20 + 15 * (Intellect - 20)) * BeamingEarthsiegeDiamondCoef)) Else MaxMana = CInt(Int((BaseMana + Intellect) * BeamingEarthsiegeDiamondCoef))
        Mana = MaxMana
        EvocationTickValue = MaxMana * 0.6 / 4
        EvocationThreshold = CInt(MaxMana * 0.4)
        ReplenishmentValue = MaxMana * 0.002

        CalcMissPerc()
        CalcMana() : ArcaneBlastMana(0) = CInt(Int(BaseMana * 0.07 * (1 - PrecisionPerc) * (1 - ArcaneFocusPerc) * (1 - FrostChannelingPerc)))
        CalcCastTimes()
        CalcCritPerc()
        CalcCritCoef()
        CalcBonusDamage()
        CalcDamageCoef()

        BonusDamageOriginal = BonusDamage : HitRatingOriginal = HitRating : CritRatingOriginal = CritRating
        HasteRatingOriginal = HasteRating : StatMP5Original = StatMP5 : IntellectOriginal = Intellect : SpiritOriginal = Spirit
        b = 0 : z = 0 : gDamageTotal = 0 : gManaConsumed = 0 : gManaGained = 0 : HighestDPS = 0 : LowestDPS = 999999999 : LongestManaDump = 0 : ShortestManaDump = 999999999

        Do
            If bTwoMinTrinket Then TwoMinTrinket = False : TwoMinTrinketStart = -99999 : TFofVolatilePowerStack = 0 : MeteoriteCrystalStack = 0
            If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoul = False : IllustrationoftheDragonSoulStack = 0 : IllustrationoftheDragonSoulStart = -99999
            If bEyeoftheBroodmother Then EyeoftheBroodmother = False : EyeoftheBroodmotherStack = 0 : EyeoftheBroodmotherStart = -99999
            If bMuradinsSpyglass Then MuradinsSpyglass = False : MuradinsSpyglassStack = 0 : MuradinsSpyglassStart = -99999
            If bDyingCurse Then DyingCurse = False : DyingCurseStart = -99999
            If bElementalFocusStone Then ElementalFocusStone = False : ElementalFocusStoneStart = -99999
            If bFlareoftheHeavens Then FlareoftheHeavens = False : FlareoftheHeavensStart = -99999
            If bPandorasPlea Then PandorasPlea = False : PandorasPleaStart = -99999
            If bMoteofFlame Then MoteofFlame = False : MoteofFlameStart = -99999 : MoteofFlameStack = 0
            If bShardofFlame Then ShardofFlame = False : ShardofFlameStart = -99999 : ShardofFlameStack = 0
            If bPurifiedLunarDust Then PurifiedLunarDust = False : PurifiedLunarDustStart = -99999
            If bShowofFaith Then ShowofFaith = False : ShowofFaithStart = -99999
            If bSifsRemembrance Then SifsRemembrance = False : SifsRemembranceStart = -99999
            If bEmbraceoftheSpider Then EmbraceoftheSpider = False : EmbraceoftheSpiderStart = -99999
            If bSundialoftheExiled Then SundialoftheExiled = False : SundialoftheExiledStart = -99999
            If bAbyssalRune Then AbyssalRune = False : AbyssalRuneStart = -99999
            If bShardoftheGods Then ShardoftheGods = False
            If bShinyShardoftheGods Then ShinyShardoftheGods = False
            If bPurifiedShardoftheGods Then PurifiedShardoftheGods = False : ShardoftheGodsStart = -99999
            If bDislodgedForeignObject Then DislodgedForeignObject = False : SurgeofPowerStart = -99999 : SurgingPowerStack = 0
            If bSliverofPureIce Then SliverofPureIce = False : SliverofPureIceStart = -99999
            If bPhylacteryoftheNamelessLich Then PhylacteryoftheNamelessLich = False : PhylacteryoftheNamelessLichStart = -99999
            If bLightweave Then Lightweave = False : LightweaveStart = -99999
            If bDarkglow Then Darkglow = False : DarkglowStart = -99999
            If bAshenBand Then AshenBand = False : AshenBandStart = -99999
            If bNibelung Then For a = 1 To 30 : Valkyr(a) = False : Next : ValkyrTally = 0
            If bInsightfulEarthsiegeDiamond Then InsightfulEarthsiegeDiamondStart = -99999
            If bBlackMagic Then BlackMagic = False : BlackMagicStart = -99999
            If bT72Piece Then T72Piece = False
            If bT82Piece Then T82Piece = False : T82PieceStart = -99999
            If bT84Piece Then T84Piece = False
            If bT102Piece Then T102Piece = False : T102PieceStart = -99999 : T102PieceCoef = 1
            If bT104Piece Then T104Piece = False : T104PieceStart = -99999 : T104PieceCoef = 1
            If bBerserking Then Berserking = False : BerserkingStart = -99999 : BerserkingCoef = 1
            If bArcaneTorrent Then ArcaneTorrentStart = -99999

            If bMissileBarrage Then MissileBarrage = False : TimetoReactMissileBarrage = False
            If bDeepFreeze Then DeepFreezeStart = -99999
            If bFireBlast Then FireBlastStart = -99999
            If bPyroblast Then Pyroblast = False : PyroblastDoT = False
            If bLivingBomb Then LivingBomb = False
            If bWaterElemental Then Waterbolt = False : WaterboltStart = -99999 : WaterElementalServerLag = 0 : WaterElementalStart = -99999 : WaterElementalCDStart = -99999 : If Not bGlyphofEternalWater Then WaterElemental = False Else WaterElemental = True : WaterElementalMana = WaterElementalMaxMana
            If bFingersofFrost Then FingersofFrost = False : ShatterCritPerc(1) = 0 : FingersofFrostStart = 99999 : FingersofFrostEnd = -99999 : FingersofFrostCount = 0 : FingersofFrostPerceivedCount = 0
            If bBrainFreeze Then BrainFreeze = False : TimetoReactBrainFreeze = 99999 : FrostfireBoltCanProcBrainFreeze = True
            If bIgnite Then Ignite = False : IgnitePool = 0
            If bCombustion Then Combustion = False : CombustionEnd = -99999 : CombustionDamagePerc = 0 : CombustionCritPerc = 0 : CombustionCount = 0 : PerceivedCombustionCount = 0
            If bHotStreak Then HotStreak = False : HotStreakStart(1) = -99999 : HotStreakCount = 0
            If bPresenceofMind Then PresenceofMind = False : PresenceofMindEnd = -99999
            If bColdSnap Then ColdSnapStart = -99999
            If bWintersChill Then WintersChill = False : WintersChillDebuffStack = 0 : WintersChillDebuffPerc = 0
            If bClearcasting Then Clearcasting = False : ClearcastingStart = -99999
            If bArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0
            If bIcyVeins Then IcyVeins = False : IcyVeinsCDStart = -99999 : IcyVeinsStart = -99999 : IcyVeinsCoef = 1
            If bArcanePower Then ArcanePower = False : ArcanePowerStart = -99999 : ArcanePowerCoef = 1
            If bEnduringWinter Then EnduringWinter = False : EnduringWinterStart = -99999

            GCDStart = -99999
            Casting = False
            Channeling = False
            InvokeEvocation = False : InvokeManaGem = False
            EvocationCDStart = -99999
            If bArcaneBlast Then ArcaneBlastStack = False : ArcaneBlastStackCount = 0 : ArcaneBlastPerceivedStackCount = 0 : ArcaneBlastStackStart = -99999
            If bArcaneMissile Then ArcaneMissile = False : ArcaneMissileArcaneBlastStack = 0 : ArcaneMissileFlightStart(1) = 999999 : ArcaneMissileFlightStart(2) = 999999 : ArcaneMissileFlightStart(3) = 999999 : ArcaneMissileFlightStart(4) = 999999 : ArcaneMissileFlightStart(5) = 999999 : ArcaneMissileFireTracker = 1 : ArcaneMissileLandTracker = 1
            If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then Fireball = False : If bFireballDoT Then FireballDoT = False
            If bScorch Then Scorch = False : ScorchDebuffPerc = 0 : TimetoReactScorch = True
            If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then FrostfireBolt(0) = False : FrostfireBolt(1) = False : FrostfireBoltDoT = False : WhichFrostfireBolt = 0
            If bFrostbolt Then Frostbolt = False
            If bIceLance Then IceLance = False

            BonusDamage = BonusDamageOriginal : HitRating = HitRatingOriginal : CritRating = CritRatingOriginal : HasteRating = HasteRatingOriginal : StatMP5 = StatMP5Original : GearMP5 = GearMP5Original : Intellect = IntellectOriginal : Spirit = SpiritOriginal
            bOoM = False : bRMP = True
            Casting = False : Channeling = False : CastingStart = -99999
            gDamage = 0
            Mana = MaxMana : ManaGained = 0 : ManaConsumed = 0
            MP5Start = -99999 : ManaGemStart = -99999 : ManaGemCount = 3
            z += 1 : a = 0
            If z Mod 100 = 0 Then Application.DoEvents()
            MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50
            CalcCastTimes() : CalcCritCoef() : CalcCritPerc() : CalcBonusDamage() : CalcDamageCoef() : CalcMana()
            If bCreateLog Then
                oLog.WriteLine("This log file was created with Truecrafting version " & ProgramVersion & " from truecrafting.codeplex.com.")
                oLog.WriteLine()
                oLog.WriteLine("The following data represents all buffs/debuffs except those that are applied by the mage")
                oLog.WriteLine("during the encounter, which as of 3.3.3 is the 5% crit debuff and replenishment.")
                oLog.WriteLine()
                oLog.WriteLine("Bonus Damage:  " & BonusDamage)
                oLog.WriteLine("Hit Rating:  " & HitRating)
                oLog.WriteLine("Crit Rating:  " & CritRating)
                oLog.WriteLine("Haste Rating:  " & HasteRating)
                oLog.WriteLine("Mana Regen:  " & GearMP5 + StatMP5 & "  While Casting:  " & GearMP5 + Int(StatMP5 * MP5CastingPerc))
                oLog.WriteLine("Intellect:  " & Intellect)
                oLog.WriteLine("Spirit:  " & Spirit)
                If frmIntellect > 19 Then lTemp = CInt(Int((BaseMana + 20 + 15 * (frmIntellect - 20)) * BeamingEarthsiegeDiamondCoef)) Else lTemp = CInt(Int((BaseMana + frmIntellect) * BeamingEarthsiegeDiamondCoef))
                oLog.WriteLine("Mana:  " & MaxMana)
                oLog.WriteLine("GCD:  " & GCDDuration(0) / 100 & " sec(s)")
                oLog.WriteLine("Distance from target:  ~19 yards")
                oLog.WriteLine(sEvoFirst)

                oLog.WriteLine() : oLog.WriteLine("***** Evocation *****")
                oLog.WriteLine(CInt(lTemp * 0.6) & " mana over " & EvocationDuration / 100 & " secs")

                If bArcaneBlast Then
                    oLog.WriteLine() : oLog.WriteLine("***** Arcane Blast *****", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    oLog.WriteLine("Mana Cost:  " & ArcaneBlastMana(0))
                    'If bArcanePower Then ArcanePowerCoef = 1.2 : CalcMana() : oLog.WriteLine("Mana Cost w/Arcane Power:  " & ArcaneBlastMana(0)) : ArcanePowerCoef = 1 : CalcMana()
                    oLog.WriteLine("Bonus Damage Multiplier:  " & Format(ArcaneBlastBonusDamageCoef, "percent"))
                    oLog.WriteLine("Damage Multiplier:  " & Format(ArcaneBlastDamageCoef, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(ArcaneBlastCritCoef, "percent"))
                    oLog.WriteLine("Damage 0xAB:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (0 * ArcaneBlastStackPerc + 1), "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (0 * ArcaneBlastStackPerc + 1), "f") & "  Crit:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (0 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (0 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f"))
                    oLog.WriteLine("Damage 1xAB:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (1 * ArcaneBlastStackPerc + 1), "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (1 * ArcaneBlastStackPerc + 1), "f") & "  Crit:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (1 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (1 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f"))
                    oLog.WriteLine("Damage 2xAB:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (2 * ArcaneBlastStackPerc + 1), "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (2 * ArcaneBlastStackPerc + 1), "f") & "  Crit:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (2 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (2 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f"))
                    oLog.WriteLine("Damage 3xAB:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (3 * ArcaneBlastStackPerc + 1), "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (3 * ArcaneBlastStackPerc + 1), "f") & "  Crit:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (3 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (3 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f"))
                    oLog.WriteLine("Damage 4xAB:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (4 * ArcaneBlastStackPerc + 1), "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (4 * ArcaneBlastStackPerc + 1), "f") & "  Crit:  " & Format(ArcaneBlastBonusDamage * ArcaneBlastDamageCoef * (4 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f") & " -- " & Format((192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (4 * ArcaneBlastStackPerc + 1) * ArcaneBlastCritCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - ArcaneBlastMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(ArcaneBlastCritPerc, "percent"))
                    oLog.WriteLine(Format(ArcaneBlastDuration / 100, "f") & " sec cast")
                    If bBerserking Then BerserkingCoef = 1.1 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneBlastDuration / 100, "f") & " sec cast with 10% Berserking") : BerserkingCoef = 1 : CalcCastTimes()
                    If bIcyVeins Then IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneBlastDuration / 100, "f") & " sec cast with Icy Veins") : IcyVeinsCoef = 1 : CalcCastTimes()
                    If bBerserking And bIcyVeins Then BerserkingCoef = 1.1 : IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneBlastDuration / 100, "f") & " sec cast with Icy Veins and Berserking") : IcyVeinsCoef = 1 : BerserkingCoef = 1 : CalcCastTimes()
                End If
                If bArcaneMissile Then
                    oLog.WriteLine() : oLog.WriteLine("***** Arcane Missile *****", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    oLog.WriteLine("Mana Cost:  " & ArcaneMissileMana)
                    oLog.WriteLine("Bonus Damage Multiplier:  " & Format(ArcaneMissileBonusDamageCoef, "percent"))
                    oLog.WriteLine("Damage Multiplier:  " & Format(ArcaneMissileDamageCoef, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(ArcaneMissileCritCoef, "percent"))
                    oLog.WriteLine("Damage 0xAB:  " & Format(ArcaneMissileBonusDamage * (0 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef, "f") & "  Crit:  " & Format(ArcaneMissileBonusDamage * (0 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef * ArcaneMissileCritCoef, "f"))
                    oLog.WriteLine("Damage 1xAB:  " & Format(ArcaneMissileBonusDamage * (1 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef, "f") & "  Crit:  " & Format(ArcaneMissileBonusDamage * (1 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef * ArcaneMissileCritCoef, "f"))
                    oLog.WriteLine("Damage 2xAB:  " & Format(ArcaneMissileBonusDamage * (2 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef, "f") & "  Crit:  " & Format(ArcaneMissileBonusDamage * (2 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef * ArcaneMissileCritCoef, "f"))
                    oLog.WriteLine("Damage 3xAB:  " & Format(ArcaneMissileBonusDamage * (3 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef, "f") & "  Crit:  " & Format(ArcaneMissileBonusDamage * (3 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef * ArcaneMissileCritCoef, "f"))
                    oLog.WriteLine("Damage 4xAB:  " & Format(ArcaneMissileBonusDamage * (4 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef, "f") & "  Crit:  " & Format(ArcaneMissileBonusDamage * (4 * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef * ArcaneMissileCritCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - ArcaneMissileMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(ArcaneMissileCritPerc, "percent"))
                    oLog.WriteLine(Format(ArcaneMissileDuration / 100, "f") & " sec cast")
                    If bBerserking Then BerserkingCoef = 1.1 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileDuration / 100, "f") & " sec cast with 10% Berserking") : BerserkingCoef = 1 : CalcCastTimes()
                    If bIcyVeins Then IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileDuration / 100, "f") & " sec cast with Icy Veins") : IcyVeinsCoef = 1 : CalcCastTimes()
                    If bBerserking And bIcyVeins Then BerserkingCoef = 1.1 : IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileDuration / 100, "f") & " sec cast with Icy Veins and Berserking") : IcyVeinsCoef = 1 : BerserkingCoef = 1 : CalcCastTimes()
                    oLog.WriteLine(Format(ArcaneMissileMBDuration / 100, "f") & " sec cast with Missile Barrage")
                    If bBerserking Then BerserkingCoef = 1.1 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileMBDuration / 100, "f") & " sec cast with Missile Barrage and 10% Berserking") : BerserkingCoef = 1 : CalcCastTimes()
                    If bIcyVeins Then IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileMBDuration / 100, "f") & " sec cast with Missile Barrage and Icy Veins") : IcyVeinsCoef = 1 : CalcCastTimes()
                    If bBerserking And bIcyVeins Then BerserkingCoef = 1.1 : IcyVeinsCoef = 1.2 : CalcCastTimes() : oLog.WriteLine(Format(ArcaneMissileMBDuration / 100, "f") & " sec cast with Missile Barrage, Icy Veins, and Berserking") : IcyVeinsCoef = 1 : BerserkingCoef = 1 : CalcCastTimes()
                End If
                If bFrostfireBolt OrElse bBrainFreezeFrostfireBolt OrElse PhylacteryFrostfireBolt Then
                    oLog.WriteLine() : oLog.WriteLine("***** Frostfire Bolt *****")
                    oLog.WriteLine("Mana Cost:  " & FrostfireBoltMana)
                    oLog.WriteLine("Damage:  " & Format(FrostfireBoltBonusDamage * FrostfireBoltDamageCoef, "f") & " -- " & Format((116 + FrostfireBoltBonusDamage) * FrostfireBoltDamageCoef, "f") & " + 3*" & Format(FrostfireBoltDoTDamage, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - FrostfireBoltMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(FrostfireBoltCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(FrostfireBoltCritCoef, "percent"))
                    oLog.WriteLine(Format(FrostfireBoltDuration / 100, "f") & " sec cast")
                    'if bberserking Then oLog.WriteLine(Format(FrostfireBoltDuration / 100, "f") & " sec cast with 10% berserking")
                End If
                If bFrostbolt Then
                    oLog.WriteLine() : oLog.WriteLine("***** Frostbolt *****")
                    oLog.WriteLine("Mana Cost:  " & FrostboltMana)
                    oLog.WriteLine("Damage:  " & Format(FrostboltBonusDamage * FrostboltDamageCoef, "f") & " -- " & Format((63 + FrostboltBonusDamage) * FrostboltDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - FrostboltMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(FrostboltCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(FrostboltCritCoef, "percent"))
                    oLog.WriteLine(Format(FrostboltDuration / 100, "f") & " sec cast")
                    'if bberserking Then oLog.WriteLine(Format(FrostboltDuration / 100, "f") & " sec cast with 10% berserking")
                End If
                If bFireball OrElse bBrainFreezeFireball OrElse PhylacteryFireball Then
                    oLog.WriteLine() : oLog.WriteLine("***** Fireball *****")
                    oLog.WriteLine("Mana Cost:  " & FireballMana)
                    oLog.Write("Damage:  " & Format(FireballBonusDamage * FireballDamageCoef, "f") & " -- " & Format((245 + FireballBonusDamage) * FireballDamageCoef, "f"))
                    If bFireballDoT Then oLog.WriteLine(" + 4*" & Format(FireballDoTDamage, "f")) Else oLog.WriteLine()
                    oLog.WriteLine("Hit:  " & Format(1 - FireballMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(FireballCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(FireballCritCoef, "percent"))
                    oLog.WriteLine(Format(FireballDuration / 100, "f") & " sec cast")
                    'if bberserking Then oLog.WriteLine(Format(FireballDuration / 100, "f") & " sec cast with 10% berserking")
                End If
                If bPyroblast Then
                    oLog.WriteLine() : oLog.WriteLine("***** Pyroblast *****")
                    oLog.WriteLine("Mana Cost:  " & PyroblastMana)
                    oLog.WriteLine("Damage:  " & Format(PyroblastBonusDamage * PyroblastDamageCoef, "f") & " -- " & Format((321 + PyroblastBonusDamage) * PyroblastDamageCoef, "f") & " + 4*" & Format(PyroblastDoTBonusDamage * PyroblastDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - PyroblastMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(PyroblastCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(PyroblastCritCoef, "percent"))
                End If
                If bLivingBomb Then
                    oLog.WriteLine() : oLog.WriteLine("***** Living Bomb *****")
                    oLog.WriteLine("Mana Cost:  " & LivingBombMana)
                    oLog.WriteLine("Damage:  " & Format(LivingBombBonusDamage * LivingBombDamageCoef, "f") & " + 4*" & Format(LivingBombDoTBonusDamage * LivingBombDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - LivingBombMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(LivingBombCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(LivingBombCritCoef, "percent"))
                End If
                If bScorch Then
                    oLog.WriteLine() : oLog.WriteLine("***** Scorch *****", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    oLog.WriteLine("Mana Cost:  " & ScorchMana)
                    oLog.WriteLine("Damage:  " & Format(ScorchBonusDamage * ScorchDamageCoef, "f") & " -- " & Format((69 + ScorchBonusDamage) * ScorchDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - ScorchMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(ScorchCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(ScorchCritCoef, "percent"))
                    oLog.WriteLine(Format(ScorchDuration / 100, "f") & " sec cast")
                    'if bberserking Then oLog.WriteLine(Format(ScorchDuration / 100, "f") & " sec cast with 10% berserking")
                End If
                If bDeepFreeze Then
                    oLog.WriteLine() : oLog.WriteLine("***** Deep Freeze *****")
                    oLog.WriteLine("Mana Cost:  " & DeepFreezeMana)
                    oLog.WriteLine("Damage:  " & Format(DeepFreezeBonusDamage * DeepFreezeDamageCoef, "f") & " -- " & Format((272 + DeepFreezeBonusDamage) * DeepFreezeDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - DeepFreezeMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(DeepFreezeCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(DeepFreezeCritCoef, "percent"))
                End If
                If bIceLance Then
                    oLog.WriteLine() : oLog.WriteLine("***** Ice Lance *****")
                    oLog.WriteLine("Mana Cost:  " & IceLanceMana)
                    oLog.WriteLine("Damage:  " & Format(IceLanceBonusDamage * IceLanceDamageCoef, "f") & " -- " & Format((35 + IceLanceBonusDamage) * IceLanceDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - IceLanceMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(IceLanceCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(IceLanceCritCoef, "percent"))
                End If
                If bWaterElemental Then
                    oLog.WriteLine() : oLog.WriteLine("***** Waterbolt *****")
                    oLog.WriteLine("Mana Cost:  " & WaterboltMana)
                    oLog.WriteLine("Damage:  " & Format(WaterboltBonusDamage * WaterboltDamageCoef, "f") & " -- " & Format((72 + WaterboltBonusDamage) * WaterboltDamageCoef, "f"))
                    oLog.WriteLine("Hit:  " & Format(1 - WaterboltMissPerc, "percent"))
                    oLog.WriteLine("Crit:  " & Format(WaterboltCritPerc, "percent"))
                    oLog.WriteLine("Crit Multiplier:  " & Format(1.5, "percent"))
                    oLog.WriteLine(Format(WaterboltDuration(0) / 100, "f") & " sec cast")
                End If

                oLog.WriteLine() : oLog.WriteLine("The following is a log of the first mana dump out of the thousands")
                oLog.WriteLine("performed to obtain the stats for this profile.") : oLog.WriteLine()
                oLog.WriteLine("-- = action made by Truecrafting's AI") : oLog.WriteLine("** = WoW mechanic") : oLog.WriteLine()
                sLogTabIndex = "{0,-65}{1,-13}{2,-10}{3,-10}" : oLog.WriteLine(sLogTabIndex, "Events", "Mana", "Damage", "DPS") : oLog.WriteLine("---------------------------------------------------------------------------------------------")
            End If
            Do
                a += 1
                If a Mod 10 = 0 Then
                    If a - MP5Start < 500 Then fTemp = MP5Casting Else fTemp = MP5NotCasting
                    Mana += fTemp : ManaGained += fTemp : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                    If bReplenishment Then
                        If a Mod 100 = 0 Then
                            Mana += ReplenishmentValue : ManaGained += ReplenishmentValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                            If WaterElemental Then WaterElementalMana += WaterElementalReplenishmentValue : If WaterElementalMana > WaterElementalMaxMana Then WaterElementalMana = WaterElementalMaxMana
                        End If
                    ElseIf EnduringWinter And (a - EnduringWinterStart) Mod 100 = 0 And a > EnduringWinterStart Then
                        Mana += ReplenishmentValue : ManaGained += ReplenishmentValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                        If WaterElemental Then WaterElementalMana += WaterElementalReplenishmentValue : If WaterElementalMana > WaterElementalMaxMana Then WaterElementalMana = WaterElementalMaxMana
                        If a - EnduringWinterStart = 1500 Then EnduringWinter = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Replenishment> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    End If
                    If TwoMinTrinket Then
                        If a - TwoMinTrinketStart > 1999 Then
                            TwoMinTrinket = False
                            Select Case True
                                Case ShardoftheCrystalHeart : HasteRating -= 512 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Celerity> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case MaghiasMisguidedQuill : BonusDamage -= 716 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case TalismanofResurgence : BonusDamage -= 599 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Hospitality> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case ScaleofFates : HasteRating -= 432 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Scale of Fates> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case LivingFlame : BonusDamage -= 505 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Living Flame> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case EnergySiphon : BonusDamage -= 408 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Energy Siphon> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case TFofVolatilePower : HasteRating -= TFofVolatilePowerHaste * TFofVolatilePowerStack : TFofVolatilePowerStack = 0 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility>" & TFofVolatilePowerText & " fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case MeteoriteCrystal : GearMP5 -= 60 * MeteoriteCrystalStack : MeteoriteCrystalStack = 0 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End Select
                        End If
                    End If
                    If ShardoftheGods Then
                        If a - ShardoftheGodsStart < 1201 Then
                            If ShardoftheGodsStart Mod 200 = 0 Then
                                If a - ShardoftheGodsStart = a Then ShardoftheGods = False
                                If bPurifiedShardoftheGods Then fDamage = 477 * GlobalDamageCoef(1) * FirePowerCoef Else fDamage = 532 * GlobalDamageCoef(1) * FirePowerCoef
                                If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Searing Flames for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) : If Not ShardoftheGods Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Searing Flames fade", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                        End If
                    End If
                    If MoteofFlame Then
                        MoteofFlame = False : MoteofFlameStack += 1 : If bCreateLog Then If MoteofFlameStack < 3 Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mote of Flame> (" & MoteofFlameStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        If MoteofFlameStack = 3 Then
                            MoteofFlameStack = 0
                            If Rnd() > GlobalMissPerc(1) Then
                                fDamage = (Rnd() * 282 + 1741) * GlobalDamageCoef(1) * FirePowerCoef
                                If Rnd() < GlobalCritPerc Then fDamage *= BaseCritCoef
                                If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mote of Flame> fades, Pillar of Flame for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                            Else
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mote of Flame> fades, Pillar of Flame misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                        End If
                    End If
                    If ShardofFlame Then
                        ShardofFlame = False : ShardofFlameStack += 1 : If bCreateLog Then If ShardofFlameStack < 3 Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Shard of Flame> (" & ShardofFlameStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        If ShardofFlameStack = 3 Then
                            ShardofFlameStack = 0
                            If Rnd() > GlobalMissPerc(1) Then
                                fDamage = (Rnd() * 316 + 1959) * GlobalDamageCoef(1) * FirePowerCoef
                                If Rnd() < GlobalCritPerc Then fDamage *= BaseCritCoef
                                If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Shard of Flame> fades, Pillar of Flame for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                            Else
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Shard of Flame> fades, Pillar of Flame misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                        End If
                    End If
                    If DislodgedForeignObject Then
                        If a - SurgeofPowerStart = 2000 Then
                            BonusDamage -= DislodgedForeignObjectSP * SurgingPowerStack + DislodgedForeignObjectSP : CalcBonusDamage() : SurgingPowerStack = 0 : DislodgedForeignObject = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power> <Surging Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        ElseIf (a - SurgeofPowerStart) Mod 200 = 0 And a > SurgeofPowerStart Then
                            SurgingPowerStack += 1 : BonusDamage += DislodgedForeignObjectSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surging Power> (" & SurgingPowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If T72Piece Then If a - ManaGemStart > 1499 Then T72Piece = False : BonusDamage -= 225 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Surge> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If T82Piece Then If a - T82PieceStart > 999 Then T82Piece = False : BonusDamage -= 350 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Praxis> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If T102Piece Then If a - T102PieceStart > 499 Then T102Piece = False : T102PieceCoef = 1 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pushing the Limit> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If T104Piece Then If a - T104PieceStart > 2999 Then T104Piece = False : T104PieceCoef = 1 : CalcDamageCoef() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mirror Image> <Quad Core> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If Lightweave Then If a - LightweaveStart > 1499 Then Lightweave = False : BonusDamage -= 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If DyingCurse Then If a - DyingCurseStart > 999 Then DyingCurse = False : BonusDamage -= 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If ElementalFocusStone Then If a - ElementalFocusStoneStart > 999 Then ElementalFocusStone = False : HasteRating -= 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If FlareoftheHeavens Then If a - FlareoftheHeavensStart > 999 Then FlareoftheHeavens = False : BonusDamage -= 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If PandorasPlea Then If a - PandorasPleaStart > 999 Then PandorasPlea = False : BonusDamage -= 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If PurifiedLunarDust Then If a - PurifiedLunarDustStart > 1499 Then PurifiedLunarDust = False : GearMP5 -= 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If ShowofFaith Then If a - ShowofFaithStart > 1499 Then ShowofFaith = False : GearMP5 -= 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If SifsRemembrance Then If a - SifsRemembranceStart > 1499 Then SifsRemembrance = False : GearMP5 -= 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If EyeoftheBroodmother Then If a - EyeoftheBroodmotherStart > 999 Then EyeoftheBroodmother = False : BonusDamage -= 25 * EyeoftheBroodmotherStack : CalcBonusDamage() : EyeoftheBroodmotherStack = 0 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If IllustrationoftheDragonSoul Then If a - IllustrationoftheDragonSoulStart > 999 Then IllustrationoftheDragonSoul = False : BonusDamage -= 20 * IllustrationoftheDragonSoulStack : CalcBonusDamage() : IllustrationoftheDragonSoulStack = 0 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If MuradinsSpyglass Then If a - MuradinsSpyglassStart > 999 Then MuradinsSpyglass = False : BonusDamage -= MuradinsSpyglassSP * MuradinsSpyglassStack : CalcBonusDamage() : MuradinsSpyglassStack = 0 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If EmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 999 Then EmbraceoftheSpider = False : HasteRating -= 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If SundialoftheExiled Then If a - SundialoftheExiledStart > 999 Then SundialoftheExiled = False : BonusDamage -= 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If AbyssalRune Then If a - AbyssalRuneStart > 999 Then AbyssalRune = False : BonusDamage -= 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If BlackMagic Then If a - BlackMagicStart > 999 Then BlackMagic = False : HasteRating -= 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If AshenBand Then If a - AshenBandStart > 999 Then AshenBand = False : BonusDamage -= 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If PhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 1999 Then PhylacteryoftheNamelessLich = False : BonusDamage -= PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))

                    If IcyVeins Then If a - IcyVeinsStart > 1999 Then IcyVeins = False : IcyVeinsCoef = 1 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Icy Veins> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If ArcanePower Then If a - ArcanePowerStart >= ArcanePowerDuration Then ArcanePower = False : ArcanePowerCoef = 1 : CalcDamageCoef() : CalcMana() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Power> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If bClearcasting Then
                        If a - ClearcastingStart = 0 Then
                            Clearcasting = True
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bArcanePotency Then ArcanePotency = True : ArcanePotencyPerc(1) = ArcanePotencyPerc(0) : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        ElseIf Clearcasting And a - ClearcastingStart = 1500 Then
                            Clearcasting = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If bFingersofFrost Then
                        If a > FingersofFrostStart Then
                            FingersofFrost = True : FingersofFrostStart = a + 99999 : FingersofFrostEnd = a + 1500 : FingersofFrostCount = 0 : ShatterCritPerc(1) = ShatterCritPerc(0) : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Fingers of Frost>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        ElseIf FingersofFrost And a > FingersofFrostEnd Then
                            FingersofFrost = False : FingersofFrostCount = 0 : ShatterCritPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Fingers of Frost> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If ArcaneBlastStack Then If a - ArcaneBlastStackStart > 599 Then ArcaneBlastStack = False : ArcaneBlastStackCount = 0 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Blast stack expires", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If Berserking Then If a - BerserkingStart > 999 Then Berserking = False : BerserkingCoef = 1 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Berserking> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If Scorch Then If a - ScorchDebuffStart > 2999 Then Scorch = False : ImpScorchCritPerc = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Scorch debuff fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If Combustion Then If CombustionCount > 2 Then If a - CombustionEnd > 10 Then CombustionEnd = a + 10 Else CombustionCount = 0 : PerceivedCombustionCount = 0 : CombustionCritPerc = 0 : CalcCritPerc() : CombustionDamagePerc = 0 : CalcCritCoef() : Combustion = False : CalcDamageCoef() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Combustion> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If bHotStreak Then
                        If HotStreak Then If a - HotStreakStart(0) > 999 Then HotStreak = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Hotstreak> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        If a - HotStreakStart(1) = 0 Then HotStreak = True : HotStreakStart(0) = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Hotstreak>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    End If
                    If FireballDoT Then
                        If (a - FireballDoTStart) Mod 200 = 0 And a > FireballDoTStart Then
                            If Rnd() > FireballDoTDamage - Int(FireballDoTDamage) Then lTemp = CInt(Int(FireballDoTDamage)) Else lTemp = CInt(Int(FireballDoTDamage)) + 1
                            gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Fireball tick for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If a - FireballDoTStart = 800 Then FireballDoT = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Fireball fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If FrostfireBoltDoT Then
                        If (a - FrostfireBoltDoTStart) Mod 300 = 0 And a > FrostfireBoltDoTStart Then
                            If Rnd() > FrostfireBoltDoTDamage - Int(FrostfireBoltDoTDamage) Then lTemp = CInt(Int(FrostfireBoltDoTDamage)) Else lTemp = CInt(Int(FrostfireBoltDoTDamage)) + 1
                            gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostfire Bolt tick for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If a - FrostfireBoltDoTStart = 900 Then FrostfireBoltDoT = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostfire Bolt fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If PyroblastDoT Then
                        If (a - PyroblastDoTStart) Mod 300 = 0 And a > PyroblastDoTStart Then
                            If Rnd() > PyroblastDoTDamage - Int(PyroblastDoTDamage) Then lTemp = CInt(Int(PyroblastDoTDamage)) Else lTemp = CInt(Int(PyroblastDoTDamage)) + 1
                            gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Pyroblast tick for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If a - PyroblastDoTStart = 1200 Then PyroblastDoT = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Pyroblast fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If Ignite Then
                        If a - IgniteStart = 200 Then
                            IgnitePool *= 0.5 : If Rnd() > IgnitePool - Int(IgnitePool) Then lTemp = CInt(IgnitePool) Else lTemp = CInt(IgnitePool) + 1
                            gDamage += lTemp : If bEmpoweredFire Then If Rnd() < EmpoweredFireIgniteRefundPerc Then Mana += IgniteRefund : ManaGained += IgniteRefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Ignite (1) for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        ElseIf a - IgniteStart = 400 Then
                            If Rnd() > IgnitePool - Int(IgnitePool) Then lTemp = CInt(IgnitePool) Else lTemp = CInt(IgnitePool) + 1
                            IgnitePool = 0 : Ignite = False : gDamage += lTemp : If bEmpoweredFire Then If Rnd() < EmpoweredFireIgniteRefundPerc Then Mana += IgniteRefund : ManaGained += IgniteRefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Ignite (2) for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        End If
                    End If
                    If LivingBomb Then
                        If (a - LivingBombStart) Mod 300 = 0 And a > LivingBombStart Then
                            If bGlyphofLivingBomb And Rnd() < LivingBombCritPerc Then
                                fDamage = LivingBombDoTCritDamage
                                If bIgnite Then Ignite = True : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10 : IgnitePool += fDamage * IgniteAddPerc
                            Else
                                fDamage = LivingBombDoTDamage
                            End If
                            If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                            gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Living Bomb tick for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                            If bPhylacteryoftheNamelessLich Then If a - PhylacteryoftheNamelessLichStart > 8999 Then If Rnd() < 0.3 Then PhylacteryoftheNamelessLichStart = a : PhylacteryoftheNamelessLich = True : BonusDamage += PhylacteryoftheNamelessLichSP : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Siphoned Power>" & PhylacteryoftheNamelessLichText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If a - LivingBombStart = 1200 Then
                                LivingBomb = False
                                If Rnd() > LivingBombMissPerc Then
                                    If Rnd() > LivingBombCritPerc Then
                                        If bHotStreak Then HotStreakCount = 0
                                        fTemp2 = LivingBombDamage
                                    Else
                                        fTemp2 = LivingBombDamage * LivingBombCritCoef
                                        If bBurnout And LivingBombManaSpent > 0 Then fTemp = LivingBombManaSpent * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp : MP5Start = a
                                        If bMasterofElements Then Mana += LivingBombMoERefund : ManaGained += LivingBombMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bHotStreak Then HotStreakCount += 1 : If HotStreakCount = 2 Then HotStreakStart(1) = (CInt(a * 0.1) + 2) * 10 : HotStreakCount = 0
                                        If Combustion Then CombustionCount += 1
                                        If bIgnite Then Ignite = True : IgnitePool += fTemp2 * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    End If
                                    If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                    If Rnd() > fTemp2 - Int(fTemp2) Then lTemp = CInt(Int(fTemp2)) Else lTemp = CInt(Int(fTemp2)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Living Bomb detonation for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Living Bomb detonation misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                            End If
                            If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                        End If
                    End If
                    If Valkyr(0) Then
                        lTemp = 0
                        ValkyrCheckTally = ValkyrTally
                        Do While ValkyrCheckTally > 0
                            lTemp += 1
                            If Valkyr(lTemp) Then
                                ValkyrCheckTally -= 1
                                If a - ValkyrGCDStart(lTemp) > ValkyrGCD + ValkyrServerLag(lTemp) Then
                                    ValkyrServerLag(lTemp) = (CInt(Rnd() * 40) + 26)
                                    ValkyrGCDStart(lTemp) = a
                                    fTemp = ValkyrGCD * 0.1
                                    If Rnd() > fTemp - Int(fTemp) Then ValkyrGCD = CInt(Int(fTemp)) * 10 Else ValkyrGCD = CInt(Int(fTemp)) * 10 + 10
                                    fTemp = (Rnd() * 194 + 1591) * ValkyrDamageCoef
                                    If Rnd() < ValkyrCritPerc Then fTemp *= 1.5
                                    If Rnd() > fTemp - Int(fTemp) Then lTemp2 = CInt(Int(fTemp)) Else lTemp2 = CInt(Int(fTemp)) + 1
                                    gDamage += lTemp2 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Smite for " & lTemp2, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If a - ValkyrStart(lTemp) > 2999 Then
                                    Valkyr(lTemp) = False : ValkyrTally -= 1 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Val'kyr fades (" & lTemp & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If ValkyrTally = 0 Then Valkyr(0) = False
                                End If
                            End If
                        Loop
                        Do While ValkyrSummonTally > 0
                            ValkyrSummonTally -= 1
                            ValkyrTally += 1
                            lTemp = 0
                            Do
                                lTemp += 1
                            Loop Until Not Valkyr(lTemp)
                            Valkyr(lTemp) = True
                            ValkyrStart(lTemp) = a
                            ValkyrServerLag(lTemp) = (CInt(Rnd() * 40) + 26)
                            ValkyrGCDStart(lTemp) = a
                            If Rnd() > fTemp - Int(fTemp) Then ValkyrGCD = CInt(Int(fTemp)) * 10 Else ValkyrGCD = CInt(Int(fTemp)) * 10 + 10
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Summon Val'kyr (" & lTemp & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        Loop
                    End If
                    If Waterbolt Then
                        If a - WaterboltFlightStart > 139 Then
                            Waterbolt = False
                            If WaterboltDamage > -1 Then
                                If Rnd() > WaterboltDamage - Int(WaterboltDamage) Then lTemp = CInt(Int(WaterboltDamage)) Else lTemp = CInt(Int(WaterboltDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Waterbolt for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            Else
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Waterbolt misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                        End If
                    End If
                    If WaterElemental Then
                        If a - WaterboltStart > WaterboltDuration(1) + WaterElementalServerLag Then
                            If WaterElementalMana - WaterboltMana > -1 Then
                                WaterElementalServerLag = (CInt(Rnd() * 40) + 26)
                                WaterboltStart = a
                                WaterboltDuration(1) = WaterboltDuration(0)
                                fTemp = WaterboltDuration(0) * 0.1
                                If Rnd() > fTemp - Int(fTemp) Then WaterboltDuration(1) = CInt(Int(fTemp)) * 10 Else WaterboltDuration(1) = CInt(Int(fTemp)) * 10 + 10
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Waterbolt", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            Else
                                WaterboltStart = -9999999
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Water Elemental is OoM", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                        ElseIf a - WaterboltStart = WaterboltDuration(1) Then
                            Waterbolt = True
                            WaterboltFlightStart = a
                            WaterElementalMana -= WaterboltMana
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Waterbolt launches (mana " & Int(WaterElementalMana) & " / " & WaterElementalMaxMana & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If Rnd() > WaterboltMissPerc Then
                                WaterboltDamage = (Rnd() * 72 + WaterboltBonusDamage) * WaterboltDamageCoef
                                If Rnd() < WaterboltCritPerc Then WaterboltDamage *= 1.5
                            Else
                                WaterboltDamage = -1
                            End If
                        End If
                        If Not bGlyphofEternalWater Then If a - WaterElementalStart > WaterElementalDuration Then WaterElemental = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Water Elemental dies", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    End If
                    Select Case True
                        Case ArcaneMissile
                            Do While ArcaneMissile And a - ArcaneMissileFlightStart(ArcaneMissileLandTracker) > 89
                                If ArcaneMissileDamage(ArcaneMissileLandTracker) > -1 Then
                                    If ArcaneMissileCrits(ArcaneMissileLandTracker) Then
                                        ArcaneMissileDamage(ArcaneMissileLandTracker) *= ArcaneMissileCritCoef
                                        If bMasterofElements Then Mana += ArcaneMissileMoERefund : ManaGained += ArcaneMissileMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    End If
                                    If Rnd() > ArcaneMissileDamage(ArcaneMissileLandTracker) - Int(ArcaneMissileDamage(ArcaneMissileLandTracker)) Then lTemp = CInt(Int(ArcaneMissileDamage(ArcaneMissileLandTracker))) Else lTemp = CInt(Int(ArcaneMissileDamage(ArcaneMissileLandTracker))) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Missile for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bClearcasting Then If Rnd() < AMCCPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Missile misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                ArcaneMissileLandTracker += 1 : If ArcaneMissileLandTracker = 6 Then ArcaneMissileLandTracker = 1 : ArcaneMissile = False : If a > ManaDumpTimeLimit Then bOoM = True : GCDStart = a + 1000
                            Loop
                        Case Fireball
                            If a - FireballFlightStart > 89 Then
                                Fireball = False
                                If FireballDamage > -1 Then
                                    If FireballCrits Then
                                        FireballDamage *= FireballCritCoef
                                        If bBurnout Then ManaConsumed += FireballManaSpent * BurnoutManaPerc : If FireballManaSpent > 0 Then MP5Start = a
                                        If bMasterofElements Then Mana += FireballMoERefund : ManaGained += FireballMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bHotStreak Then HotStreakCount += 1 : If HotStreakCount = 2 Then HotStreakStart(1) = (CInt(a * 0.1) + 2) * 10 : If bHotStreak Then HotStreakCount = 0
                                        If Combustion Then CombustionCount += 1
                                        If bIgnite Then Ignite = True : IgnitePool += FireballDamage * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    Else
                                        If bHotStreak Then HotStreakCount = 0
                                    End If
                                    If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                    If Rnd() > FireballDamage - Int(FireballDamage) Then lTemp = CInt(Int(FireballDamage)) Else lTemp = CInt(Int(FireballDamage)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Fireball for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bFireballDoT Then FireballDoT = True : FireballDoTStart = CInt(Int(a * 0.1 + 1)) * 10
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Fireball misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                            End If
                        Case Pyroblast
                            If a - PyroblastFlightStart > 89 Then
                                Pyroblast = False
                                If PyroblastDamage > -1 Then
                                    If PyroblastCrits Then
                                        PyroblastDamage *= PyroblastCritCoef
                                        If bBurnout And PyroblastManaSpent > 0 Then fTemp = PyroblastManaSpent * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp : MP5Start = a
                                        If bMasterofElements Then Mana += PyroblastMoERefund : ManaGained += PyroblastMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If Combustion Then CombustionCount += 1
                                        If bIgnite Then Ignite = True : IgnitePool += PyroblastDamage * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    End If
                                    If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                    If Rnd() > PyroblastDamage - Int(PyroblastDamage) Then lTemp = CInt(Int(PyroblastDamage)) Else lTemp = CInt(Int(PyroblastDamage)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Pyroblast for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    PyroblastDoT = True : PyroblastDoTStart = CInt(Int(a * 0.1 + 1)) * 10 : PyroblastDoTDamage = PyroblastDoTBonusDamage * PyroblastDamageCoef
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Pyroblast misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                            End If
                        Case Frostbolt
                            If a - FrostboltFlightStart > 89 Then
                                Frostbolt = False
                                If FrostboltDamage > -1 Then
                                    If FrostboltCrits Then
                                        FrostboltDamage *= FrostboltCritCoef
                                        If bMasterofElements Then Mana += FrostboltMoERefund : ManaGained += FrostboltMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    End If
                                    If Rnd() > FrostboltDamage - Int(FrostboltDamage) Then lTemp = CInt(Int(FrostboltDamage)) Else lTemp = CInt(Int(FrostboltDamage)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostbolt for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bWintersChill Then WintersChillStart = a : If WintersChillDebuffStack < 5 Then WintersChill = True : WintersChillDebuffStack += 1 : WintersChillDebuffPerc += 0.01 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Winter's Chill (" & WintersChillDebuffStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bBrainFreeze And Rnd() < BrainFreezePerc Then
                                        If Not BrainFreeze Then TimetoReactBrainFreeze = a + 75
                                        BrainFreeze = True : BrainFreezeStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Fireball!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    End If
                                    If bFingersofFrost Then If Rnd() < FingersofFrostPerc Then FingersofFrostStart = a + 10
                                    If bEnduringWinter Then If a - EnduringWinterStart > 600 Then If Rnd() < EnduringWinterApplicationPerc Then EnduringWinter = True : EnduringWinterStart = (CInt(Int(a * 0.1)) + 1) * 10 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Replenishment>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostbolt misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                            End If
                        Case FrostfireBolt(WhichFrostfireBolt)
                            If a - FrostfireBoltFlightStart(WhichFrostfireBolt) > 89 Then
                                FrostfireBolt(WhichFrostfireBolt) = False
                                If FrostfireBoltDamage(WhichFrostfireBolt) > -1 Then
                                    If FrostfireBoltCrits(WhichFrostfireBolt) Then
                                        FrostfireBoltDamage(WhichFrostfireBolt) *= FrostfireBoltCritCoef
                                        If bBurnout And FrostfireBoltManaSpent > 0 Then fTemp = FrostfireBoltMana * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp : MP5Start = a
                                        If bMasterofElements Then Mana += FrostfireBoltMoERefund : ManaGained += FrostfireBoltMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bHotStreak Then HotStreakCount += 1 : If HotStreakCount = 2 Then HotStreakStart(1) = (CInt(a * 0.1) + 2) * 10 : If bHotStreak Then HotStreakCount = 0
                                        If Combustion Then CombustionCount += 1
                                        If bIgnite Then Ignite = True : IgnitePool += FrostfireBoltDamage(WhichFrostfireBolt) * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    Else
                                        If bHotStreak Then HotStreakCount = 0
                                    End If
                                    If Rnd() > FrostfireBoltDamage(WhichFrostfireBolt) - Int(FrostfireBoltDamage(WhichFrostfireBolt)) Then lTemp = CInt(Int(FrostfireBoltDamage(WhichFrostfireBolt))) Else lTemp = CInt(Int(FrostfireBoltDamage(WhichFrostfireBolt))) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostfire Bolt for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    FrostfireBoltDoT = True : FrostfireBoltDoTStart = CInt(Int(a * 0.1 + 1)) * 10
                                    If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                    If bWintersChill Then WintersChillStart = a : If WintersChillDebuffStack < 5 Then WintersChill = True : WintersChillDebuffStack += 1 : WintersChillDebuffPerc += 0.01 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Winter's Chill (" & WintersChillDebuffStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bFingersofFrost Then If Rnd() < FingersofFrostPerc Then FingersofFrostStart = a + 10
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(WhichFrostfireBolt) = True : ValkyrSummonTally += 1
                                    If bBrainFreeze And Rnd() < BrainFreezePerc And FrostfireBoltCanProcBrainFreeze Then
                                        If Not BrainFreeze Then TimetoReactBrainFreeze = a + 75
                                        BrainFreeze = True : BrainFreezeStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Fireball!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    ElseIf Not FrostfireBoltCanProcBrainFreeze Then
                                        FrostfireBoltCanProcBrainFreeze = True
                                    End If
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostfire Bolt misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If FrostfireBolt(1) Then WhichFrostfireBolt = 1 Else WhichFrostfireBolt = 0
                            End If
                        Case IceLance
                            If IceLanceDamage > -1 Then
                                If IceLanceCrits Then
                                    IceLanceDamage *= IceLanceCritCoef
                                    If bMasterofElements Then Mana += IceLanceMoERefund : ManaGained += IceLanceMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                    If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                End If
                                fDamage = (Rnd() * 35 + IceLanceBonusDamage) * IceLanceDamageCoef * IceLanceFrozenCoef : If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Ice Lance for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bWintersChill Then WintersChillStart = a : If WintersChillDebuffStack < 5 Then WintersChill = True : WintersChillDebuffStack += 1 : WintersChillDebuffPerc += 0.01 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Winter's Chill (" & WintersChillDebuffStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                            Else
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Ice Lance misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                    End Select
                    If bOoM Then If Not (Pyroblast Or Fireball Or ArcaneMissile Or IceLance Or Frostbolt Or FrostfireBolt(0)) Then Exit Do
                    If Casting Or Channeling Then
                        If a + 9 - CastingStart < CastingDuration And WhichSpell <> 3 Then a += 9 : Continue Do
                    ElseIf a + 9 - GCDStart < GCDDuration(1) Then
                        a += 9 : Continue Do
                    End If
                End If
                If Casting And a - CastingStart = CastingDuration Then
                    Casting = False
                    If bScorch Then TimetoReactScorch = True
                    If MissileBarrage Then TimetoReactMissileBarrage = True
                    If FingersofFrost Then FingersofFrostPerceivedCount += 1
                    Select Case WhichSpell
                        Case 1
                            If Clearcasting Then
                                Clearcasting = False
                                If bBurnout Then ArcaneBlastManaSpent = 0
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            Else
                                lTemp = ArcaneBlastMana(1) + CInt(Int(ArcaneBlastMana(0) * 1.75 * ArcaneBlastStackCount))
                                Mana -= lTemp : ManaConsumed += lTemp : MP5Start = a
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                If bBurnout Then ArcaneBlastManaSpent = lTemp
                            End If
                            If Rnd() > ArcaneBlastMissPerc Then
                                fDamage = (Rnd() * 192 + ArcaneBlastBonusDamage) * ArcaneBlastDamageCoef * (ArcaneBlastStackCount * ArcaneBlastStackPerc + 1)
                                If Rnd() < ArcaneBlastCritPerc Then
                                    If bBurnout And ArcaneBlastManaSpent > 0 Then fTemp = ArcaneBlastManaSpent * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp
                                    If bMasterofElements Then Mana += ArcaneBlastMoERefund : ManaGained += ArcaneBlastMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                    If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    fDamage *= ArcaneBlastCritCoef
                                End If
                                If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : ArcaneBlastStackStart = a : If ArcaneBlastStackCount < 4 Then ArcaneBlastStackCount += 1 : ArcaneBlastStack = True
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Blast for " & lTemp & " (" & ArcaneBlastStackCount & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If ArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                            Else
                                If bCreateLog Then
                                    If ArcaneBlastStackCount > 0 Then sTemp = (a - ArcaneBlastStackStart) / 100 & " sec(s) remaining on stack" Else sTemp = "stack remains at 0"
                                    oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Blast misses, " & sTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                            End If
                            If bMissileBarrage Then If Rnd() < MissileBarrageArcaneBlastPerc Then MissileBarrage = True : MissileBarrageStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Missile Barrage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bT82Piece Then If a - T82PieceStart > 4499 Then If Rnd() < 0.25 Then T82PieceStart = a : T82Piece = True : BonusDamage += 350 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Praxis> (T8)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'arcane blast, frostbolt, frostfire bolt, fireball casts
                        Case 4
                            If BrainFreeze Then
                                If bT84Piece And Rnd() < 0.2 Then
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** T8 4-piece", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    BrainFreeze = False : If bT102Piece Then T102PieceStart = a : T102PieceCoef = 1.12 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pushing the Limit>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If bBurnout Then FireballManaSpent = 0
                            ElseIf Clearcasting Then
                                Clearcasting = False
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bBurnout Then FireballManaSpent = 0
                            Else
                                Mana -= FireballMana : ManaConsumed += FireballMana : MP5Start = a
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                If bBurnout Then FireballManaSpent = FireballMana
                            End If
                            Fireball = True
                            FireballFlightStart = a
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Fireball launches", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If Rnd() > FireballMissPerc Then
                                FireballDamage = (Rnd() * 245 + FireballBonusDamage) * FireballDamageCoef
                                If Rnd() > FireballCritPerc Then FireballCrits = False Else FireballCrits = True
                                If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                            Else
                                FireballDamage = -1
                            End If
                            If a > ManaDumpTimeLimit Then bOoM = True : GCDStart = a + 1000
                            If bMissileBarrage Then If Rnd() < MissileBarrageOtherPerc Then MissileBarrage = True : MissileBarrageStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Missile Barrage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bT82Piece Then If a - T82PieceStart > 4499 Then If Rnd() < 0.25 Then T82PieceStart = a : T82Piece = True : BonusDamage += 350 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Praxis> (T8)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'arcane blast, frostbolt, frostfire bolt, fireball casts
                        Case 5
                            If Clearcasting Then
                                Clearcasting = False
                                If bBurnout Then FrostboltManaSpent = 0
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            Else
                                Mana -= FrostboltMana : ManaConsumed += FrostboltMana : MP5Start = a
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                If bBurnout Then FrostboltManaSpent = FrostboltMana
                            End If
                            Frostbolt = True
                            FrostboltFlightStart = a
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostbolt launches", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If Rnd() > FrostboltMissPerc Then
                                FrostboltDamage = (Rnd() * 63 + FrostboltBonusDamage) * FrostboltDamageCoef
                                If Rnd() > FrostboltCritPerc Then FrostboltCrits = False Else FrostboltCrits = True
                                If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                            Else
                                FrostboltDamage = -1
                            End If
                            If a > ManaDumpTimeLimit Then bOoM = True : GCDStart = a + 1000
                            If bMissileBarrage Then If Rnd() < MissileBarrageOtherPerc Then MissileBarrage = True : MissileBarrageStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Missile Barrage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bT82Piece Then If a - T82PieceStart > 4499 Then If Rnd() < 0.25 Then T82PieceStart = a : T82Piece = True : BonusDamage += 350 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Praxis> (T8)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'arcane blast, frostbolt, frostfire bolt, fireball casts
                        Case 6
                            If Clearcasting Then
                                Clearcasting = False
                                If bBurnout Then ScorchManaSpent = 0
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            Else
                                Mana -= ScorchMana : ManaConsumed += ScorchMana : MP5Start = a
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                If bBurnout Then ScorchManaSpent = ScorchMana
                            End If
                            If Combustion Then PerceivedCombustionCount = CombustionCount + 1
                            If Rnd() > ScorchMissPerc Then
                                fDamage = (Rnd() * 69 + ScorchBonusDamage) * ScorchDamageCoef
                                If Rnd() > ScorchCritPerc Then
                                    If bHotStreak Then HotStreakCount = 0
                                Else
                                    fDamage *= ScorchCritCoef
                                    If bBurnout And ScorchManaSpent > 0 Then fTemp = ScorchManaSpent * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp
                                    If bMasterofElements Then Mana += ScorchMoERefund : ManaGained += ScorchMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If Combustion Then CombustionCount += 1
                                    If bIgnite Then Ignite = True : IgnitePool += fDamage * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                    If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                    If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    If bHotStreak Then HotStreakCount += 1 : If HotStreakCount = 2 Then HotStreakStart(1) = (CInt(a * 0.1) + 2) * 10
                                End If
                                If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Scorch for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If Rnd() < ImpScorchDebuffApplicationPerc Then ScorchDebuffStart = a : If Not Scorch Then Scorch = True : ScorchDebuffPerc = 0.05 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Scorch debuff applied", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If ArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                                If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                            Else
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Scorch misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                            If bScorch Then TimetoReactScorch = False
                        Case 7
                            If FrostfireBolt(0) Then WhichFrostfireBolt = 1
                            If BrainFreeze And CastingDuration = 1 Then
                                FrostfireBoltCanProcBrainFreeze = False
                                If bT84Piece And Rnd() < 0.2 Then
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** T8 4-piece", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    BrainFreeze = False : If bT102Piece Then T102PieceStart = a : T102PieceCoef = 1.12 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pushing the Limit>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If bBurnout Then FrostfireBoltManaSpent = 0
                            ElseIf Clearcasting Then
                                Clearcasting = False
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bBurnout Then FrostfireBoltManaSpent = 0
                            Else
                                Mana -= FrostfireBoltMana : ManaConsumed += FrostfireBoltMana : MP5Start = a
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                If bBurnout Then FrostfireBoltManaSpent = FrostfireBoltMana
                            End If
                            FrostfireBolt(WhichFrostfireBolt) = True
                            FrostfireBoltFlightStart(WhichFrostfireBolt) = a
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Frostfire Bolt launches", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If Rnd() > FrostfireBoltMissPerc Then
                                FrostfireBoltDamage(WhichFrostfireBolt) = (Rnd() * 116 + FrostfireBoltBonusDamage) * FrostfireBoltDamageCoef
                                If Rnd() > FrostfireBoltCritPerc Then FrostfireBoltCrits(WhichFrostfireBolt) = False Else FrostfireBoltCrits(WhichFrostfireBolt) = True
                                If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                            Else
                                FrostfireBoltDamage(WhichFrostfireBolt) = -1
                            End If
                            If a > ManaDumpTimeLimit Then bOoM = True : GCDStart = a + 1000
                            If bMissileBarrage Then If Rnd() < MissileBarrageOtherPerc Then MissileBarrage = True : MissileBarrageStart = a : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Missile Barrage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bT82Piece Then If a - T82PieceStart > 4499 Then If Rnd() < 0.25 Then T82PieceStart = a : T82Piece = True : BonusDamage += 350 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Praxis> (T8)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'arcane blast, frostbolt, frostfire bolt, fireball casts
                            If WhichFrostfireBolt = 1 Then WhichFrostfireBolt = 0
                    End Select
                    If PresenceofMind Then
                        PresenceofMind = False
                        PresenceofMindEnd = a
                        If bScorch Then TimetoReactScorch = True
                        If MissileBarrage Then TimetoReactMissileBarrage = True
                        If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Presence of Mind> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    End If
                    If ArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                    If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                    If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                    If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                    If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                    If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                    If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                    If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                    If TFofVolatilePower Then If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                ElseIf Channeling Then
                    Select Case WhichSpell
                        Case 2
                            If a - CastingStart = ArcaneMissileFireInterval(ArcaneMissileFireTracker) Then
                                Do
                                    ArcaneMissile = True
                                    ArcaneMissileFlightStart(ArcaneMissileFireTracker) = a
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Arcane Missile launches", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If Rnd() > ArcaneMissileMissPerc Then
                                        ArcaneMissileDamage(ArcaneMissileFireTracker) = ArcaneMissileBonusDamage * (ArcaneMissileArcaneBlastStack * ArcaneBlastStackPerc + 1) * ArcaneMissileDamageCoef
                                        If Rnd() > ArcaneMissileCritPerc Then ArcaneMissileCrits(ArcaneMissileFireTracker) = False Else ArcaneMissileCrits(ArcaneMissileFireTracker) = True
                                    Else
                                        ArcaneMissileDamage(ArcaneMissileFireTracker) = -1
                                    End If
                                    If ArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                    If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                    If TwoMinTrinket Then
                                        Select Case True
                                            Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                            Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                        End Select
                                    End If
                                    If ArcaneMissileFireTracker < 5 Then ArcaneMissileFireTracker += 1 Else Channeling = False : ArcaneMissileFireTracker = 1 : a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1) : If bT102Piece Then T102PieceStart = a : T102Piece = True : T102PieceCoef = 1.12 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pushing the Limit>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    CastingDuration = ArcaneMissileFireInterval(ArcaneMissileFireTracker)
                                Loop Until a - CastingStart <> ArcaneMissileFireInterval(ArcaneMissileFireTracker)
                            End If
                        Case 3
                            If (a - CastingStart) Mod EvocationTickInterval = 0 Then
                                If Rnd() > EvocationTickValue - Int(EvocationTickValue) Then lTemp = CInt(Int(EvocationTickValue)) Else lTemp = CInt(Int(EvocationTickValue)) + 1
                                Mana += lTemp : ManaGained += lTemp : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Evocation tick for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            End If
                            If a - CastingStart = CastingDuration Then
                                Channeling = False
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                                If bScorch Then TimetoReactScorch = True
                                If MissileBarrage Then TimetoReactMissileBarrage = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                            End If
                    End Select
                ElseIf Not (Casting Or Channeling) Then
                    GCD = a - GCDStart < GCDDuration(1)
                    If bArcaneTorrent And a - ArcaneTorrentStart > 11999 And (NotEvoFirst Or a - CastingStart < 12000) And MaxMana - Mana > MaxMana * 0.063 Then
                        ArcaneTorrentStart = a
                        fTemp = MaxMana * 0.06
                        Mana += fTemp : ManaGained += fTemp : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Arcane Torrent", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                    ElseIf bSliverofPureIce And a - SliverofPureIceStart > 11999 And (NotEvoFirst Or a - CastingStart < 12000) And MaxMana - Mana > SliverofPureIceMana + 100 Then
                        SliverofPureIceStart = a
                        Mana += SliverofPureIceMana : ManaGained += SliverofPureIceMana : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Sliver of Pure Ice", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    ElseIf InvokeManaGem OrElse a - ManaGemStart > 11999 And ManaGemCount > 0 And (NotEvoFirst Or a - EvocationCDStart < 12000) And (MaxMana - Mana > 4590 Or (Not bT72Piece And MaxMana - Mana > 3715)) Then
                        fTemp = (Rnd() * 170 + 3330) * T72PieceCoef * ManaGemCoef
                        Mana += fTemp : ManaGained += fTemp : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                        InvokeManaGem = False
                        ManaGemCount -= 1
                        ManaGemStart = a
                        If bT72Piece Then T72Piece = True : BonusDamage += 225 : CalcBonusDamage()
                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Mana Gem (" & ManaGemCount & " remaining)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) : If T72Piece Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Surge>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    ElseIf bColdSnap And a - ColdSnapStart > ColdSnapCD And (Not bDeepFreeze Or a - DeepFreezeStart < 2000) And (Not bIcyVeins Or a - IcyVeinsCDStart < 11000) And _
                    (Not bWaterElemental Or bGlyphofEternalWater Or a - WaterElementalCDStart < WaterElementalCDDuration * 0.9) Then
                        ColdSnapStart = a
                        IcyVeinsCDStart = -99999
                        DeepFreezeStart = -99999
                        WaterElementalCDStart = -99999
                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Cold Snap", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                    ElseIf Not GCD Then
                        If InvokeEvocation OrElse a - EvocationCDStart > EvocationCD And Mana < EvocationThreshold And (Not MissileBarrage Or ArcaneBlastStackCount < 3) And (Not Clearcasting Or ArcaneBlastStackCount < 3) And _
                        (Not bLivingBomb Or 1200 - (a - LivingBombStart) > EvocationDuration * 0.5) And _
                        (Not Combustion Or CombustionCount < 2) And _
                        (Not TwoMinTrinket Or 2000 - (a - TwoMinTrinketStart) < LongestSpell) And _
                        (Not IcyVeins Or 2000 - (a - IcyVeinsStart) < LongestSpell) And _
                        (Not ArcanePower Or ArcanePowerDuration - (a - ArcanePowerStart) < LongestSpell) And _
                        (Not Berserking Or 1000 - (a - BerserkingStart) < LongestSpell) And _
                        (Not bScorch Or 3000 - (a - ScorchDebuffStart) > EvocationDuration * 0.5) And _
                        (Not FingersofFrost Or FingersofFrostPerceivedCount = 0) And _
                        (Not BrainFreeze Or 1500 - (a - BrainFreezeStart) > EvocationDuration) Then
                            InvokeEvocation = False
                            WhichSpell = 3
                            Channeling = True
                            CastingStart = a
                            CastingDuration = EvocationDuration
                            EvocationCDStart = a
                            EvocationTickInterval = CInt(Int(EvocationDuration / 4))
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Evocation", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                        ElseIf bTwoMinTrinket And a - TwoMinTrinketStart > 11999 And (Not bT104Piece Or a - T104PieceStart < 16500) And _
                        (Not bArcanePower Or a - ArcanePowerStart < ArcanePowerCD - 1500 Or a - ArcanePowerStart > ArcanePowerCD - 400) And _
                        (Not bCombustion Or a - CombustionEnd < 11000) And _
                        (Not bLivingBomb Or a - LivingBombStart > 1000) Then
                            TwoMinTrinket = True : TwoMinTrinketStart = a
                            Select Case True
                                Case MaghiasMisguidedQuill : BonusDamage += 716 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case ShardoftheCrystalHeart : HasteRating += 512 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Celerity>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case TalismanofResurgence : BonusDamage += 599 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Hospitality>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case ScaleofFates : HasteRating += 432 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Scale of Fates>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case LivingFlame : BonusDamage += 505 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Living Flame>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case EnergySiphon : BonusDamage += 408 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Energy Siphon>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Case TFofVolatilePower : TFofVolatilePower = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Volatility>" & TFofVolatilePowerText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any harmful spell
                                Case MeteoriteCrystal : MeteoriteCrystal = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                            End Select
                        ElseIf bT104Piece And a - T104PieceStart > 17999 And (Not bScorch Or Scorch) And (Not bArcaneBlast Or ArcaneBlastStackCount > 1) Then
                            If Mana - MirrorImagesMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Mirror Images, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If bScorch Then TimetoReactScorch = True
                                If MissileBarrage Then TimetoReactMissileBarrage = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                Mana -= MirrorImagesMana : ManaConsumed += MirrorImagesMana : MP5Start = a
                                MirrorImages = True
                                T104Piece = True
                                T104PieceStart = a
                                T104PieceCoef = 1.18
                                CalcDamageCoef()
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Mirror Image> <Quad Core>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bIcyVeins And Not IcyVeins And a - IcyVeinsCDStart > IcyVeinsCD And (Not bT104Piece Or a - T104PieceStart < 16500) Then
                            If Mana - IcyVeinsMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast <Icy Veins>, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                Mana -= IcyVeinsMana : ManaConsumed += IcyVeinsMana : MP5Start = a
                                IcyVeins = True
                                IcyVeinsStart = a
                                IcyVeinsCDStart = a
                                IcyVeinsCoef = 1.2
                                CalcCastTimes()
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Icy Veins>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                            End If
                        ElseIf bBerserking And a - BerserkingStart > 17999 And (Not bT104Piece Or a - T104PieceStart < 16500) And _
                        (Not bIcyVeins Or a - IcyVeinsStart < IcyVeinsCD - 1300) And (Not bArcanePower Or a - ArcanePowerStart < ArcanePowerCD - 1300) Then
                            BerserkingStart = a
                            Berserking = True
                            BerserkingCoef = 1.1
                            CalcCastTimes()
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Berserking (+10%)", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        ElseIf bArcanePower And a - ArcanePowerStart > ArcanePowerCD And (Not bT104Piece Or a - T104PieceStart < 16500) And Not PresenceofMind And _
                        (Not bIcyVeins Or a - IcyVeinsStart < IcyVeinsCD - 1300) Then '0.90277777777777
                            ArcanePower = True
                            ArcanePowerStart = a
                            ArcanePowerCoef = 1.2
                            CalcDamageCoef()
                            CalcMana()
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Arcane Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        ElseIf bCombustion And a - CombustionEnd > 11999 And Not HotStreak And Not Pyroblast And _
                        (Not bScorch Or ((Scorch Or (Not Scorch And TimetoReactScorch = False)) And a - ScorchDebuffStart < 2500)) And (Not bLivingBomb Or a - LivingBombStart < 900) Then
                            Combustion = True
                            CombustionEnd = a
                            CombustionDamagePerc = 0.5
                            CalcCritCoef()
                            CalcDamageCoef()
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Combustion>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        ElseIf bFireBlast And a - FireBlastStart > FireBlastCD And Scorch And Not HotStreak And (Not Combustion Or CombustionCount = 1) Then
                            If Mana - FireBlastMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Living Bomb, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                FireBlastStart = a
                                If Clearcasting Then
                                    Clearcasting = False
                                    If bBurnout Then FireBlastManaSpent = 0
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    Mana -= FireBlastMana : ManaConsumed += FireBlastMana : MP5Start = a
                                    If bBurnout Then FireBlastManaSpent = FireBlastMana
                                End If
                                If Rnd() > FireBlastMissPerc Then
                                    fDamage = (Rnd() * 170 + FireBlastBonusDamage) * FireBlastDamageCoef
                                    If Rnd() > FireBlastCritPerc Then
                                        If bHotStreak Then HotStreakCount = 0
                                    Else
                                        fDamage *= FireBlastCritCoef
                                        If bBurnout And FireBlastManaSpent > 0 Then fTemp = FireBlastManaSpent * BurnoutManaPerc : Mana -= fTemp : ManaConsumed += fTemp
                                        If bMasterofElements Then Mana += FireBlastMoERefund : ManaGained += FireBlastMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If Combustion Then CombustionCount += 1
                                        If bIgnite Then Ignite = True : IgnitePool += fDamage * IgniteAddPerc : IgniteStart = CInt(Int(a * 0.1 + 1)) * 10
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                        If bHotStreak Then HotStreakCount += 1 : If HotStreakCount = 2 Then HotStreakStart(1) = (CInt(a * 0.1) + 2) * 10
                                    End If
                                    If Combustion Then CombustionCritPerc += 0.1 : CalcCritPerc()
                                    If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Fire Blast for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If ArcanePotency Then ArcanePotency = False : ArcanePotencyPerc(1) = 0 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Fire Blast misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If bScorch Then TimetoReactScorch = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bLivingBomb And Not LivingBomb And _
                        (Not HotStreak Or HotStreakCount = 0 Or Not Fireball) And (Not Combustion Or CombustionCount < 1) Then
                            If Mana - LivingBombMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Living Bomb, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If bScorch Then TimetoReactScorch = True
                                If Clearcasting Then
                                    Clearcasting = False : LivingBombManaSpent = 0 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    Mana -= LivingBombMana : ManaConsumed += LivingBombMana : MP5Start = a
                                    If bBurnout Then LivingBombManaSpent = LivingBombMana
                                End If
                                If Rnd() > LivingBombMissPerc Then
                                    LivingBomb = True
                                    LivingBombStart = (CInt(a * 0.1) + 2) * 10
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Living Bomb", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Living Bomb misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bDeepFreeze And a - DeepFreezeStart > 2999 And FingersofFrost And FingersofFrostPerceivedCount = 2 Then
                            If Mana - DeepFreezeMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Living Bomb, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If Clearcasting Then
                                    Clearcasting = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    Mana -= DeepFreezeMana : ManaConsumed += DeepFreezeMana : MP5Start = a
                                End If
                                If Rnd() > DeepFreezeMissPerc Then
                                    fDamage = (Rnd() * 272 + DeepFreezeBonusDamage) * DeepFreezeDamageCoef
                                    If Rnd() < DeepFreezeCritPerc Then
                                        fDamage *= DeepFreezeCritCoef
                                        If bMasterofElements Then Mana += DeepFreezeMoERefund : ManaGained += DeepFreezeMoERefund : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                        If bMoteofFlame Then If a - MoteofFlameStart > 199 Then MoteofFlame = True : MoteofFlameStart = a
                                        If bShardofFlame Then If a - ShardofFlameStart > 199 Then ShardofFlame = True : ShardofFlameStart = a
                                    End If
                                    If Rnd() > fDamage - Int(fDamage) Then lTemp = CInt(Int(fDamage)) Else lTemp = CInt(Int(fDamage)) + 1
                                    gDamage += lTemp : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Deep Freeze for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bWintersChill Then WintersChillStart = a : If WintersChillDebuffStack < 5 Then WintersChill = True : WintersChillDebuffStack += 1 : WintersChillDebuffPerc += 0.01 : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** Winter's Chill (" & WintersChillDebuffStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    If bClearcasting Then If Rnd() < ClearcastingPerc Then ClearcastingStart = (CInt(a * 0.1) + 2) * 10
                                    If bJoW Then If Rnd() < 0.5 Then Mana += JoWValue : ManaGained += JoWValue : If Mana > MaxMana Then ManaGained -= (Mana - MaxMana) : Mana = MaxMana
                                    If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                                    If bMuradinsSpyglass Then MuradinsSpyglassStart = a : If MuradinsSpyglassStack < 10 Then MuradinsSpyglassStack += 1 : BonusDamage += MuradinsSpyglassSP : CalcBonusDamage() : MuradinsSpyglass = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Cultivated Power>" & MuradinsSpyglassText & " (" & MuradinsSpyglassStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes
                                    If bShardoftheGods Then If a - ShardoftheGodsStart > 4499 Then If Rnd() < 0.15 Then ShardoftheGodsStart = a : ShardoftheGods = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Searing Flames>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful strikes
                                    If bBlackMagic Then If a - BlackMagicStart > 3499 Then If Rnd() < 0.35 Then BlackMagicStart = a : BlackMagic = True : HasteRating += 250 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Black Magic>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strikes and living bomb ticks
                                    If bAshenBand Then If a - AshenBandStart > 5999 Then If Rnd() < 0.1 Then AshenBand = True : AshenBandStart = a : BonusDamage += 285 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Frostforged Sage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful strike + living bomb application
                                    If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                Else
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Deep Freeze misses", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                DeepFreezeStart = a
                                If bScorch Then TimetoReactScorch = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bIceLance And FingersofFrostPerceivedCount = 2 Then
                            If Mana - IceLanceMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Living Bomb, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                IceLanceFlightStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Ice Lance launches")
                                If Clearcasting Then
                                    Clearcasting = False : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    Mana -= IceLanceMana : ManaConsumed += IceLanceMana : MP5Start = a
                                End If
                                If Rnd() > IceLanceMissPerc Then
                                    IceLanceDamage = (Rnd() * 35 + IceLanceBonusDamage) * IceLanceDamageCoef
                                    If Rnd() > IceLanceCritPerc Then IceLanceCrits = False Else IceLanceCrits = True
                                    If FingersofFrost Then FingersofFrostCount += 1 : If FingersofFrostCount = 2 Then FingersofFrostEnd = a + 20
                                Else
                                    IceLanceDamage = -1
                                End If
                                If bScorch Then TimetoReactScorch = True
                                If MissileBarrage Then TimetoReactMissileBarrage = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf HotStreak And (Not Combustion Or ((bScorchFiller And PerceivedCombustionCount = 3) Or (CombustionCount = 2 And (Fireball Or FrostfireBolt(0))))) Then
                            If Mana - PyroblastMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Pyroblast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If bScorch Then TimetoReactScorch = True
                                Pyroblast = True
                                PyroblastFlightStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Pyroblast", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If Clearcasting Then
                                    Clearcasting = False
                                    If bBurnout Then PyroblastManaSpent = 0
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    Mana -= PyroblastMana : ManaConsumed += PyroblastMana : MP5Start = a
                                    If bBurnout Then PyroblastManaSpent = PyroblastMana
                                End If
                                If bT84Piece And Rnd() < 0.2 Then
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** T8 4-piece, " & HotStreakStart(0) / 100 & " sec(s) remaining on Hotstreak", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    HotStreak = False : HotStreakStart(0) = -9999999 : If bT102Piece Then T102PieceStart = a : T102PieceCoef = 1.12 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pushing the Limit>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                End If
                                If Rnd() > PyroblastMissPerc Then
                                    PyroblastDamage = (Rnd() * 321 + PyroblastBonusDamage) * PyroblastDamageCoef
                                    If Rnd() > PyroblastCritPerc Then PyroblastCrits = False Else PyroblastCrits = True
                                Else
                                    PyroblastDamage = -1
                                End If
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bScorch And TimetoReactScorch And Not FingersofFrost And a - FingersofFrostStart < 75 And (Not Scorch Or 3000 - (a - ScorchDebuffStart) < ScorchDuration) OrElse _
                        bScorchFiller And (Not bPresenceofMind Or a - PresenceofMindEnd < PresenceofMindCD) Then
                            If Mana - ScorchMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Scorch, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                WhichSpell = 6
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                Casting = True
                                CastingStart = a
                                CastingDuration = ScorchDuration
                                If Combustion Then PerceivedCombustionCount = CombustionCount
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Scorch", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bWaterElemental And a - WaterElementalCDStart > WaterElementalCDDuration And (Not WaterElemental Or WaterElementalMana < WaterboltMana) Then
                            If Mana - SummonWaterElementalMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Pyroblast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If bScorch Then TimetoReactScorch = True
                                If MissileBarrage Then TimetoReactMissileBarrage = True
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                Mana -= SummonWaterElementalMana : ManaConsumed += SummonWaterElementalMana : MP5Start = a
                                WaterboltStart = -99999
                                WaterboltDuration(1) = WaterboltDuration(0)
                                WaterElemental = True
                                WaterElementalStart = a
                                WaterElementalCDStart = a
                                WaterElementalMana = WaterElementalMaxMana
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Summon Water Elemental", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If TwoMinTrinket Then If MeteoriteCrystal Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bPresenceofMind And Not PresenceofMind And a - PresenceofMindEnd > PresenceofMindCD And Not ArcanePower And _
                        (Not bArcaneBlast Or ArcaneBlastStackCount = 4) Then
                            PresenceofMind = True
                            If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- <Presence of Mind>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bArcanePotency Then ArcanePotency = True : ArcanePotencyPerc(1) = ArcanePotencyPerc(0) : CalcCritPerc() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Arcane Potency>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                            If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                            If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                        ElseIf bFireball And (Not LivingBomb Or 1200 - (a - LivingBombStart) > FireballDuration * 0.1) OrElse _
                        BrainFreeze And bBrainFreezeFireball And a > TimetoReactBrainFreeze And (Not FingersofFrost Or FingersofFrostPerceivedCount = 2) OrElse _
                        PhylacteryFireball And Not FireballDoT And Not Fireball And (Not bArcanePower Or a - ArcanePowerStart > ArcanePowerCD - FireballDuration) And a - PhylacteryoftheNamelessLichStart > 8799 - FireballDuration Then
                            If Not (Clearcasting And BrainFreeze) And Mana - FireballMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Arcane Blast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                WhichSpell = 4
                                Casting = True
                                CastingStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Fireball", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If BrainFreeze Or PresenceofMind Then CastingDuration = 1 Else CastingDuration = FireballDuration : a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bFrostfireBolt And (Not LivingBomb Or 1200 - (a - LivingBombStart) > CastingDuration * 0.15) OrElse _
                        BrainFreeze And bBrainFreezeFrostfireBolt And a > TimetoReactBrainFreeze And (Not FingersofFrost Or FingersofFrostPerceivedCount = 2) OrElse _
                        PhylacteryFrostfireBolt And Not FrostfireBoltDoT And Not FrostfireBolt(0) And (Not bArcanePower Or a - ArcanePowerStart > ArcanePowerCD - FrostfireBoltDuration) And a - PhylacteryoftheNamelessLichStart > 8799 - FireballDuration Then
                            If Not (Clearcasting And BrainFreeze) And Mana - FrostfireBoltMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Arcane Blast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                WhichSpell = 7
                                Casting = True
                                CastingStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Frostfire Bolt", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If BrainFreeze Or PresenceofMind Then CastingDuration = 1 Else CastingDuration = FrostfireBoltDuration : a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bArcaneMissile And _
                        (MissileBarrage And TimetoReactMissileBarrage And Not PresenceofMind And _
                         (ArcaneBlastStackCount = 0 Or _
                          (ArcaneBlastStackCount > 1 And b2xABMBAM) Or _
                          (ArcaneBlastStackCount > 2 And (b3xABMBAM Or b2xABMBAM)) Or _
                          (ArcaneBlastStackCount = 4 And (b4xABMBAM Or b3xABMBAM Or b2xABMBAM Or b4xABAM)) Or _
                          (IcyVeins And 2000 - (a - IcyVeinsStart) < ArcaneBlastDuration) Or _
                          (DislodgedForeignObject And 2000 - (a - SurgeofPowerStart) < ArcaneBlastDuration) Or _
                          (ArcanePower And ArcanePowerDuration - (a - ArcanePowerStart) < ArcaneBlastDuration) Or _
                          (Mana < EvocationThreshold And a - EvocationCDStart > EvocationCD) Or _
                          (Mana - (ArcaneBlastMana(1) + ArcaneBlastMana(0) * 1.75 * ArcaneBlastStackCount) < 0 And ArcaneBlastStackCount > 2) _
                         ) _
                        ) OrElse _
                        (Not MissileBarrage And ArcaneBlastStackCount = 4 And (b4xABAM Or b3xABMBAM Or b2xABMBAM)) Then
                            If Not (MissileBarrage Or Clearcasting) And Mana - ArcaneMissileMana < 0 Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Arcane Missiles, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If bScorch Then TimetoReactScorch = True
                                If MissileBarrage Then TimetoReactMissileBarrage = True
                                WhichSpell = 2
                                Channeling = True
                                CastingStart = a
                                ArcaneMissileArcaneBlastStack = ArcaneBlastStackCount
                                ArcaneBlastStackCount = 0
                                ArcaneBlastStack = False
                                If MissileBarrage Then
                                    CastingDuration = ArcaneMissileMBDuration
                                    If bBurnout Then ArcaneMissileManaSpent = 0
                                    If bT84Piece And Rnd() < 0.2 Then
                                        If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** T8 4-piece, " & (1500 - (a - MissileBarrageStart)) / 100 & " sec(s) remaining on <Missile Barrage>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                    Else
                                        TimetoReactMissileBarrage = False : MissileBarrage = False
                                    End If
                                ElseIf Clearcasting Then
                                    CastingDuration = ArcaneMissileDuration
                                    Clearcasting = False
                                    If bBurnout Then ArcaneMissileManaSpent = 0
                                    If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Clearcasting> fades", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    CastingDuration = ArcaneMissileDuration
                                    lTemp = ArcaneMissileMana
                                    Mana -= lTemp : ManaConsumed += lTemp : MP5Start = a
                                    If bBurnout Then ArcaneMissileManaSpent = lTemp
                                End If
                                ArcaneMissileFireInterval(1) = CInt(CastingDuration * 0.2)
                                ArcaneMissileFireInterval(2) = CInt(ArcaneMissileFireInterval(1) + CastingDuration * 0.2 + Rnd() * 10 - 5)
                                If ArcaneMissileFireInterval(2) > CastingDuration Then ArcaneMissileFireInterval(2) = CastingDuration
                                ArcaneMissileFireInterval(3) = CInt(ArcaneMissileFireInterval(2) + CastingDuration * 0.2 + Rnd() * 10 - 5)
                                If ArcaneMissileFireInterval(3) > CastingDuration Then ArcaneMissileFireInterval(3) = CastingDuration
                                ArcaneMissileFireInterval(4) = CInt(ArcaneMissileFireInterval(3) + CastingDuration * 0.2 + Rnd() * 10 - 5)
                                If ArcaneMissileFireInterval(4) > CastingDuration Then ArcaneMissileFireInterval(4) = CastingDuration
                                ArcaneMissileFireInterval(5) = CastingDuration
                                CastingDuration = ArcaneMissileFireInterval(1)
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Arcane Missiles", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If bEmbraceoftheSpider Then If a - EmbraceoftheSpiderStart > 4499 Then If Rnd() < 0.1 Then EmbraceoftheSpiderStart = a : EmbraceoftheSpider = True : HasteRating += 505 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Embrace of the Spider>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPurifiedLunarDust Then If a - PurifiedLunarDustStart > 4499 Then If Rnd() < 0.1 Then PurifiedLunarDust = True : PurifiedLunarDustStart = a : GearMP5 += 304 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Revitalized>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bShowofFaith Then If a - ShowofFaithStart > 4499 Then If Rnd() < 0.1 Then ShowofFaithStart = a : ShowofFaith = True : GearMP5 += 241 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Show of Faith>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bSifsRemembrance Then If a - SifsRemembranceStart > 4499 Then If Rnd() < 0.1 Then SifsRemembranceStart = a : SifsRemembrance = True : GearMP5 += 195 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Memories of Love>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bLightweave Then If a - LightweaveStart > 4499 Then If Rnd() < 0.35 Then LightweaveStart = a : Lightweave = True : BonusDamage += 295 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Lightweave>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDarkglow Then If a - DarkglowStart > 5999 Then If Rnd() < 0.35 Then DarkglowStart = a : AddMana(400) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Darkglow>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bInsightfulEarthsiegeDiamond Then If a - InsightfulEarthsiegeDiamondStart > 1499 Then If Rnd() < 0.05 Then InsightfulEarthsiegeDiamondStart = a : AddMana(600) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Mana Restore>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bDyingCurse Then If a - DyingCurseStart > 4499 Then If Rnd() < 0.15 Then DyingCurseStart = a : DyingCurse = True : BonusDamage += 765 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Dying Curse>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bPandorasPlea Then If a - PandorasPleaStart > 4499 Then If Rnd() < 0.1 Then PandorasPleaStart = a : PandorasPlea = True : BonusDamage += 751 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Pandora's Plea>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any
                                If bElementalFocusStone Then If a - ElementalFocusStoneStart > 4499 Then If Rnd() < 0.1 Then ElementalFocusStoneStart = a : ElementalFocusStone = True : HasteRating += 522 : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Alacrity of the Elements>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bSundialoftheExiled Then If a - SundialoftheExiledStart > 4499 Then If Rnd() < 0.1 Then SundialoftheExiledStart = a : SundialoftheExiled = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Now is the time!>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bAbyssalRune Then If a - AbyssalRuneStart > 4499 Then If Rnd() < 0.25 Then AbyssalRuneStart = a : AbyssalRune = True : BonusDamage += 590 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Elusive Power>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bFlareoftheHeavens Then If a - FlareoftheHeavensStart > 4499 Then If Rnd() < 0.1 Then FlareoftheHeavensStart = a : FlareoftheHeavens = True : BonusDamage += 850 : CalcBonusDamage() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Flame of the Heavens>", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bEyeoftheBroodmother Then EyeoftheBroodmotherStart = a : If EyeoftheBroodmotherStack < 5 Then EyeoftheBroodmotherStack += 1 : BonusDamage += 25 : CalcBonusDamage() : EyeoftheBroodmother = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Eye of the Broodmother> (" & EyeoftheBroodmotherStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bIllustrationoftheDragonSoul Then IllustrationoftheDragonSoulStart = a : If IllustrationoftheDragonSoulStack < 10 Then IllustrationoftheDragonSoulStack += 1 : BonusDamage += 20 : CalcBonusDamage() : IllustrationoftheDragonSoul = True : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Illustration of the Dragon Soul> (" & IllustrationoftheDragonSoulStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful and helpful casts
                                If bDislodgedForeignObject Then If a - SurgeofPowerStart > 4499 Then If Rnd() < 0.1 Then DislodgedForeignObject = True : SurgeofPowerStart = (CInt(Int(a * 0.1)) + 1) * 10 : BonusDamage += DislodgedForeignObjectSP : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Surge of Power>" & DislodgedForeignObjectText, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'harmful casts
                                If bNibelung Then If Rnd() < 0.02 Then Valkyr(0) = True : ValkyrSummonTally += 1
                                If TwoMinTrinket Then
                                    Select Case True
                                        Case TFofVolatilePower : If TFofVolatilePowerStack < 8 Then TFofVolatilePowerStack += 1 : HasteRating += TFofVolatilePowerHaste : CalcCastTimes() : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Volatility> (" & TFofVolatilePowerStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                        Case MeteoriteCrystal : If MeteoriteCrystalStack < 20 Then If MeteoriteCrystalStack < 20 Then MeteoriteCrystalStack += 1 : GearMP5 += 75 : MP5NotCasting = (GearMP5 + StatMP5) / 50 : MP5Casting = (GearMP5 + Int(StatMP5 * MP5CastingPerc)) / 50 : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " ** <Meteoric Inspiration> (" & MeteoriteCrystalStack & ")", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100))) 'any costing mana
                                    End Select
                                End If
                            End If
                        ElseIf bArcaneBlast Then
                            If Mana - (ArcaneBlastMana(1) + ArcaneBlastMana(0) * 1.75 * ArcaneBlastStackCount) < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Arcane Blast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                WhichSpell = 1
                                Casting = True
                                CastingStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Arcane Blast", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If PresenceofMind Then CastingDuration = 1 Else CastingDuration = ArcaneBlastDuration : a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        ElseIf bFrostbolt Then
                            If Mana - FrostboltMana < 0 And Not Clearcasting Then
                                If a - EvocationCDStart > EvocationCD Then
                                    InvokeEvocation = True
                                ElseIf ManaGemStart < 1 And ManaGemCount > 0 Then
                                    InvokeManaGem = True
                                ElseIf bRMP Then
                                    bRMP = False : lTemp = CInt(Rnd() * 200) + 4200 : AddMana(lTemp) : If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Runic Mana Potion for " & lTemp, Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                Else
                                    bOoM = True : GCDStart = a + 1000 : If bCreateLog Then oLog.WriteLine(Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & "s " & "Unable to cast Arcane Blast, ending sequence after any in-flight spells have landed...")
                                End If
                            Else
                                GCDStart = a
                                GCDDuration(1) = GCDDuration(0)
                                If FingersofFrost Then FingersofFrostPerceivedCount = FingersofFrostCount
                                WhichSpell = 5
                                Casting = True
                                CastingStart = a
                                If bCreateLog Then oLog.WriteLine(sLogTabIndex, Format(Int(a / 100 / 60), "00") & ":" & Format(a / 100 - Int(a / 100 / 60) * 60, "00.00") & " -- Frostbolt", Int(Mana) & "/" & MaxMana, gDamage, CInt(gDamage / (a / 100)))
                                If PresenceofMind Then CastingDuration = 1 Else CastingDuration = FrostboltDuration : a += (CInt(Int(a * 0.1)) + 1) * 10 - (a + 1)
                            End If
                        End If
                    End If
                End If
            Loop
            gDamage = CLng((gDamage * 0.65 + gDamage * 0.35 * MoltenFuryCoef) * 0.959)
            DPS = CInt(gDamage / (a / 100))
            If bCreateLog Then
                If a > ManaDumpTimeLimit Then oLog.WriteLine("Time limit exceeded, mana might be infinite.  Ending log and beginning another loop.")
                oLog.WriteLine()
                If bMoltenFury Then oLog.WriteLine(DPS & " DPS with Molten Fury and boss' unavoidable 15 resistance factored in.") Else oLog.WriteLine(DPS & " DPS with boss' unavoidable 15 resistance factored in.")
                bCreateLog = False
            End If
            b += a
            gDamageTotal += gDamage
            gManaConsumed += ManaConsumed
            gManaGained += ManaGained
            If DPS > HighestDPS Then HighestDPS = DPS
            If DPS < LowestDPS Then LowestDPS = DPS
            If a > LongestManaDump Then LongestManaDump = a
            If a < ShortestManaDump Then ShortestManaDump = a
        Loop Until b > RunTimeLimit
        oLog.Close()
    End Sub
    Private Sub btnManageGearProfile1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnManageGearProfile1.Click
        frmProfile1.Show() : frmProfile1.BringToFront()
    End Sub
    Private Sub btnManageGearProfile2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnManageGearProfile2.Click
        frmProfile2.Show() : frmProfile2.BringToFront()
    End Sub
    Private Sub btnManageProfile3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnManageGearProfile3.Click
        frmProfile3.Show() : frmProfile3.BringToFront()
    End Sub
    Private Sub btnManageProfile4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnManageGearProfile4.Click
        frmProfile4.Show() : frmProfile4.BringToFront()
    End Sub
    Private Sub txtLocksSP_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLocksSP.TextChanged
        If Val(txtLocksSP.Text) < 0 Then txtLocksSP.Text = "0"
        If Val(txtLocksSP.Text) > 9999 Then txtLocksSP.Text = "9999"
    End Sub
    Private Sub cbTopMost_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbTopMost.CheckedChanged
        bTemp = cbTopMost.Checked : Me.TopMost = bTemp : frmProfile1.TopMost = bTemp : frmProfile2.TopMost = bTemp : frmProfile3.TopMost = bTemp : frmProfile4.TopMost = bTemp
    End Sub
    Private Sub linkDonate_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles linkDonate.LinkClicked
        Diagnostics.Process.Start("https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KPBBKZ2EZHDK8&lc=US&item_name=Truecrafting&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted")
    End Sub
    Private Sub linkWebsite_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles linkWebsite.LinkClicked
        Diagnostics.Process.Start("http://truecrafting.codeplex.com/")
    End Sub
End Class